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

GridMaskedEditColumn Width in edit mode

3 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
EJ
Top achievements
Rank 1
EJ asked on 18 Jun 2010, 11:51 PM
i cannot seem to set the width of the gridmaskededitcolumn in a radgrid when it's in edit mode - it always seems to go to some set size instead of the size I set it to - how do I set the width?

<telerik:GridMaskedColumn DataField="contactcontent" UniqueName="contactcontent" 
                        FooterStyle-Width="90px" HeaderStyle-Width="90px" ItemStyle-Width="90px" Mask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 
                        HeaderText="Contact" ColumnEditorID="ContactContentGridTextBoxColumnEditor"
                    </telerik:GridMaskedColumn> 
                    <telerik:GridMaskedColumn DataField="contactsecondarycontent" UniqueName="contactsecondarycontent" 
                        FooterStyle-Width="25px" HeaderStyle-Width="25px" ItemStyle-Width="25px" Mask="aaaaa" 
                        HeaderText="Ext." ColumnEditorID="ContactContentGridTextBoxColumnEditor"
                    </telerik:GridMaskedColumn> 
 
<telerik:GridMaskedColumnEditor ID="ContactContentMaskedColumnEditor" runat="server" 
            MaskedTextBox-PromptChar=" " MaskedTextBox-DisplayPromptChar=" " MaskedTextBox-DisplayMask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 
            MaskedTextBox-Mask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
            <MaskedTextBox runat="server" Width="90px" DisabledStyle-Width="90px" EmptyMessageStyle-Width="90px" 
                EnabledStyle-Width="90px" FocusedStyle-Width="90px" HoveredStyle-Width="90px" 
                InvalidStyle-Width="90px" ReadOnlyStyle-Width="90px" PromptChar=" " DisplayPromptChar=" " 
                DisplayMask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 
                Mask="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" /> 
        </telerik:GridMaskedColumnEditor> 
        <telerik:GridMaskedColumnEditor ID="SecondaryContentMaskedColumnEditor" runat="server" 
            MaskedTextBox-PromptChar=" " MaskedTextBox-DisplayPromptChar=" " MaskedTextBox-DisplayMask="aaaaa" 
            MaskedTextBox-Mask="aaaaa"
            <MaskedTextBox runat="server" Width="25px" DisabledStyle-Width="25px" EmptyMessageStyle-Width="25px" 
                EnabledStyle-Width="25px" FocusedStyle-Width="25px" HoveredStyle-Width="25px" 
                InvalidStyle-Width="25px" ReadOnlyStyle-Width="25px" PromptChar=" " DisplayPromptChar=" " 
                DisplayMask="aaaaa" Mask="aaaaa" /> 
        </telerik:GridMaskedColumnEditor> 




also does anyone know how to get rid of the "_" on the display of the values promptchar does not work - it always shows the underlines even when i put in the " " instead as seen above

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Jun 2010, 07:20 AM
Hello,

Try the following code snippet from code behind and see whether this works for you.

C#:
 
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            GridEditFormItem edititem = (GridEditFormItem)e.Item; 
            RadMaskedTextBox txt = (RadMaskedTextBox)edititem["contactcontent"].Controls[0]; 
            txt.DisplayPromptChar = " "
            txt.PromptChar = " "
            txt.Width = Unit.Pixel(150); 
        } 
    } 

Thanks,
Princy.
0
EJ
Top achievements
Rank 1
answered on 21 Jun 2010, 11:21 AM
thanks for you help! that fixed it - got rid of the editcolumn editors and setting the mask (not the display mask but the mask) and the promptchar = " " and displaypromptchar = ""

since this is changing values when the individual row is created is it possible to change the mask depending on the value of another field that is a griddropdowncolumn? if so can this be done both when the data is displayed (I can see how to do that on itemdatabound) but how about when the value of a dropdown changes in the row that is being edited - being able to change the mask would be helpful then
0
Dimo
Telerik team
answered on 24 Jun 2010, 09:32 AM
Hello EJ,

Changing the RadMaskedTextBox mask on the client is not officially supported, but is possible:

http://www.telerik.com/community/forums/aspnet-ajax/input/setting-mask-with-javascript.aspx

Best wishes,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
EJ
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
EJ
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or