Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
Adding Mask to UltraWebGrid Column Dynamically
posted

Hi All,

I need to add the mask to columns of the grid dynamically, but no luck so for , but the i can add the mask as below

1.Create Mask control in aspx page with required InputMask

<igtxt:WebMaskEdit id="WebMaskEdit1" runat="server" BorderStyle="None" InputMask="(###) ###-####" Font-Size="8pt" Font-Names="Verdana"></igtxt:WebMaskEdit>

2.In  the code behind page , to the column of the grid add the mask id as below

grdMain.DisplayLayout.Bands(0).Columns.FromKey(col.ColumnName.ToUpper()).EditorControlID = WebMaskEdit1.UniqueID

But when i create the WebMaskEdit control dynamically as

                       Dim WebMaskEdit1 As New WebDataInput.WebMaskEdit
                        WebMaskEdit1.Visible = True
                        WebMaskEdit1.ID = "wmControl" & col.ColumnName
                        WebMaskEdit1.BorderStyle = BorderStyle.None
                        WebMaskEdit1.Style.Add("Font-Size", "8pt")
                        WebMaskEdit1.InputMask = "(###) ###-####"
                        grdMain.Controls.Add(WebMaskEdit1)

and add the grid column as below

grdMain.DisplayLayout.Bands(0).Columns.FromKey(col.ColumnName.ToUpper()).EditorControlID = WebMaskEdit1.UniqueID

not working as expected

Thanks

-Ramesh.P

 

  • 12025
    posted

    Hi Ramesh, 

    Take a look at this document article to learn how to use editor controls in the grid: 

    http://help.infragistics.com/NetAdvantage/ASPNET/2010.2/CLR4.0/?page=WebGrid_Adding_a_Custom_Editor_Control_to_WebGrid.html

    -Taz.