Christopher Borys
Top achievements
Rank 1
Christopher Borys
asked on 07 Dec 2009, 02:06 AM
My numeric columns are right aligned. In the edit mode (in place) I get a TextBox input that is left aligned. I would like to have the text box that is right aligned e.g. numeric text is right justified within edit box. Is this possible? Anybody know how?
Chris
Chris
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 07 Dec 2009, 05:51 AM
Hello Christopher,
Check out the following example which should right align the text in the RadNumericTextBox for a NumericColumn when in EditMode:
aspx:
c#:
Thanks
Princy.
Check out the following example which should right align the text in the RadNumericTextBox for a NumericColumn when in EditMode:
aspx:
| <telerik:GridNumericColumn HeaderText="Numeric Column" DataField="Number" DataType="System.Int32" UniqueName="NumericColumn"> |
| <ItemStyle HorizontalAlign="Right"/> |
| </telerik:GridNumericColumn> |
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["NumericColumn"].Controls[0]; |
| rdnmrctxtbx.Style.Add("text-align", "right"); |
| } |
| } |
Thanks
Princy.
0
Christopher Borys
Top achievements
Rank 1
answered on 08 Dec 2009, 03:02 AM
Even after using this code, when I switch from View to Edit mode, initially the cell is left aligned. The cell gets right aligned when I click on it. This is even more awkward. I guess there is still something more that can be set but I have no clue what?
0
Princy
Top achievements
Rank 2
answered on 08 Dec 2009, 06:58 AM
Hi Christopher,
Can you try setting the following css style and see if it makes a difference:
c#:
css:
Thanks
Princy.
Can you try setting the following css style and see if it makes a difference:
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["NumericColumn"].Controls[0]; |
| rdnmrctxtbx.CssClass = "myclass"; |
| } |
| } |
css:
| .myclass |
| { |
| text-align:rightright !important; |
| } |
Thanks
Princy.