Numeric column default justification formating should be RIGHT. Moreover, if the (ItemStyle-HorizontalAlign="Right") is set, there should not be any questions how the content is supposed to be aligned. However, when going to EDIT MODE (InPlace), the edit box show the content on the LEFT. Even, if I asign the style for the edit box in the ItemDataBound() as follows:
textbox = (
RadNumericTextBox)editItem["AmountPayorFC"].Controls[0];
textbox.NumberFormat.AllowRounding =
true;
textbox.NumberFormat.DecimalDigits = 0;
textbox.Style.Add(
"text-align", "right");
the edit box shows the content on the LEFT. When I click inside the box, then the content switches to the RIGHT.
I am using IE8. This is very anoying and incorrect.
Chris
9 Answers, 1 is accepted
You can try setting the css class for the RadNumericTextbox as shown below:
c#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
GridEditableItem dataItem = (GridEditableItem)e.Item; |
RadNumericTextBox rdnmrctxtbx = (RadNumericTextBox)dataItem["AmoutPayorFC"].Controls[0]; |
rdnmrctxtbx.CssClass = "myclass"; |
} |
} |
css:
.myclass |
{ |
text-align:right !important; |
} |
Thanks
Princy.
Would you ensure that you are using the latest version of the controls and see if the behavior is different? The latest release is version 2016.3.914.
In case the behavior persists would you open a support ticket and send us a screenshot and more detailed information on your scenario and the issue you are having.
It would be great if you can submit a runnable sample replicating the problematic behavior. Thus we will be able to examine the issue locally and look for its cause.
Regards,
Viktor Tachev
Telerik by Progress
Hello Viktor
Thanks for the response.
Telerik Rad grid EditMode="Batch" and the code is
<telerik:GridNumericColumn DataField="I_RATE" HeaderText="Currency Rate" UniqueName="Rate" HeaderStyle-Width="200px" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" MaxLength="2">
<ItemStyle HorizontalAlign="Right"></ItemStyle>
<ColumnValidationSettings EnableRequiredFieldValidation="true">
<RequiredFieldValidator ForeColor="Red" Text="*" Display="Dynamic">
</RequiredFieldValidator>
</ColumnValidationSettings>
</telerik:GridNumericColumn>
My problem is Currency rate column is right aligned - no pproblem but when i Add an item or edit Currency rate column, the typable box is not right aligned. Please see the attached file and you can easily understand the problem.
Thanks again
Thank you for the clarification. To modify the appearance of the NumericTextBox you can use an external editor for RadGrid.
The markup would look similar to the following:
<
telerik:GridNumericColumn
DataField
=
"I_RATE"
HeaderText
=
"Currency Rate"
UniqueName
=
"Rate"
ColumnEditorID
=
"NumericEditor1"
HeaderStyle-Width
=
"200px"
HeaderStyle-HorizontalAlign
=
"Right"
ItemStyle-HorizontalAlign
=
"Right"
>
<
ItemStyle
HorizontalAlign
=
"Right"
></
ItemStyle
>
<
ColumnValidationSettings
EnableRequiredFieldValidation
=
"true"
>
<
RequiredFieldValidator
ForeColor
=
"Red"
Text
=
"*"
Display
=
"Dynamic"
>
</
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridNumericColumn
>
<
telerik:GridNumericColumnEditor
runat
=
"server"
ID
=
"NumericEditor1"
>
<
NumericTextBox
runat
=
"server"
EnabledStyle-HorizontalAlign
=
"Right"
FocusedStyle-HorizontalAlign
=
"Right"
></
NumericTextBox
>
</
telerik:GridNumericColumnEditor
>
Regards,
Viktor Tachev
Telerik by Progress
Hi Viktor,
Great, that's solved my issue. I also had the problem of setting the MaxLength. That's also solved with your solution.
<telerik:GridNumericColumnEditor runat="server" ID="NumericEditor1">
<NumericTextBox runat="server" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" MaxLength="10"></NumericTextBox>
</telerik:GridNumericColumnEditor>
Thank you very much.
I am glad that the suggested approach is working for you.
If you would like to limit the maximal value that can be entered in the numeric input it is recommended to use the MaxValue property.
Regards,
Viktor Tachev
Telerik by Progress
Hi viktor
Ok thanks
Regards
V.Yuvaraj