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
60
UltraWebGrid/TemplatedColumn changing clientID of embedded controls
posted

 Hello,

I have a custom control that uses it's own ClientID to set up some javascript for later inside the "CreateChildControls" function.  The custom controls are put into TemplatedColumns, and then at some point between the creation of the templated column and the rendering of the page, the grid changes the client ID of the control and leaves all the previously mentioned javascript useless!

 For example, in the CreateChildControls() function of the custom control, the ClientID is "Grid1_ctl02_LOCATIONPrimitiveControl".  But after putting the control inside a templated column, the ClientID becomes "Grid1_ci_0_2_0_LOCATIONPrimitiveControl".

 Has anyone else had trouble with this and are there any suggestions for a fix/workaround?

 Thanks in advance!

Jason

  • 5118
    posted

    Hello Jason,

     I have not seen the Grid change the IDs to that extent but the controls embedded inside the TemplateColumn are placed in a Template, which will work like any normal template... changing ids, scoping, etc.

    What i've done in the past is if the child controls in the template are Infragistics controls you can handle the Initialize client side event of that control and you've got the id passed to you, store it in a global javascript variable for the page. 

     Also I've written out a script block from the server that will send the UniqueID of the control to the page as a global javascript variable. 

     Both of these solutions will avoid hard-coding any ids (which is quite nice).