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

Filter template with RegisterClientScript

2 Answers 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mathew
Top achievements
Rank 1
Mathew asked on 29 Feb 2012, 10:56 AM
Hi,

I'm trying to use a custom filter template with a RadComboBox, which I have been able to do.  I'm now attempting to extend that with the use of checkboxes for multiple selection, however I'm having trouble with the javascript.  The grid and the combo are both created dynamically in code-behind, and doesn't contain any markup.

I have seen some of the examples here, including the one below to find a control:
var combo = $find("<%= RadComboBox1.ClientID %>");

My question really is how to do exactly as above, but using ClientScript.RegisterClientScriptBlock.  Obviously I can't use the markup evalutate functions (<%=) but whenever I try doing $find("RadComboBox.ClientId") I get a null or undefined error.  Any help?

Thanks,
Mathew

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Mar 2012, 05:47 AM
Hello Mathew,

When you are creating controls dynamically, one suggestion is you can pass the ClientID(RadComboBox1.ClientID)  from server side and access the controls via javascript.

-Shinu.
0
Mathew
Top achievements
Rank 1
answered on 02 Mar 2012, 05:54 PM
Hi Shinu,

That's exactly what I was doing, but because I was calling the RegisterClientScript method before the page PreRender, the client IDs of the control weren't set correctly.

I'm now having some trouble presisting values in the Filter Template - when I perform a postback the value is always null, even if something has been selected.  This was working properly before I moved the controls into the template, and I'm beginning to think that I'm going to have to resort to more JavaScript here because values from the controls don't seem to presist ever?
Tags
Grid
Asked by
Mathew
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mathew
Top achievements
Rank 1
Share this question
or