I have asp.net page where I am using a gridView with custom paging and within the gridview there is a DropDownList control and per-row control-based javascript that does a form submit and must refer to a unique DropDownList name pertaining to it's row.
Usually if I need to manipulate controls I have been accustomed to using the "on databinding to row" type of event to "FindControl". But in this case I cannot do this because the client script will only refer to this control after it is rendered.
In the grid view template area where the DropDownList is placed, I tried to output something of the sort:
... ID='<%# Eval("myID") + "_ddl" %>' ...
..just as an example, but the compiler/parser said "Bark, Bark, growl Bark" you can't do this because an id for the DopDownList can't be assigned like this. I also attempted to assign the CLientID of the control on row databind, but it wouldn't allow that either because that is a write only property.
Is there any easy way to actually take control of the ddl name? I really want to avoid changing the structure of what is going. I don't need to find the ddl name, I actually need to make every ddl in each row unique. The onclick is actually coming from another control in its row. and Unfortunately the JavaScript is inline. The issue is that the javascript is looking for the ddl with a unique name and in grid view the names for the ddl are all the same. My question is how do I force a unique name ID for the ddl in a grid view. Can this be done. It won't allow me in the methods that i have mentioned above.
Some background on this is that, this data used to be in a plain table with no paging. I had to move it into a gridview and do a custom paging.
Advice is much appreciated..Thanks!