This is a migrated thread and some comments may be shown as answers.

GridMaskedColumn - align text right

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pradeep Fernandes
Top achievements
Rank 1
Pradeep Fernandes asked on 30 Mar 2009, 02:27 PM
I am using the GridMaskedColumn while trying to prevent the user from entering alphabetical and special characters other then numbers, need a way to specify the alignment for the text within the column textbox when in edit mode, such that it is always right aligned. The text is align left by default.
I tried using the CssClass property and setting the text-align style to right align but it does not work. Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Mar 2009, 10:04 AM
Hi Pradeep,

Try the following approach and see whether helps you.

CSS:
<style type="text/css">  
.MyClass  
{  
    text-align:right !important;  
}  
</style> 

ASPX:
<telerik:GridMaskedColumn UniqueName="MaskedColumn" DataField="Description"  ItemStyle-HorizontalAlign="Right" HeaderText="Description" > 
</telerik:GridMaskedColumn> 

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
    {  
        GridDataItem dataItem = e.Item as GridDataItem;  
        RadMaskedTextBox textbox = (RadMaskedTextBox) dataItem["MaskedColumn"].Controls[0];  
        textbox.CssClass = "MyClass";  
    }          

Thanks,
Princy.
Tags
Grid
Asked by
Pradeep Fernandes
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or