There isn't a single instance of the dropdownlist. When you put a control
into a template list, the "normal" declaretive model isn't correct anymore.
If you do:
<itemTemplate>
<asp:dropdownlist id="x" runat="server" />
</itemTemplate>
you can't simply manipulate X like you would any other control. Which "X"
do you want? The one in row1, row2, row3??
Typically, you hook into the grids/list/repeater's ItemDataBound event,
which fires for each row being bound:
e.Item <-- the row being bound. From that, you can access the dropdownlist
via a FindControl
DropDownList x = (DropDownList)e.Item.FindControl("x");
take a look at:
http://openmymind.net/MyArticles.aspx?documentId=8
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"JebBushell" <jebbushell AT yahoo DOT com> wrote in message
news:E7**********************************@microsof t.com...
I have an existing page, that works, and I'm trying to enhance it by adding
a
dropdown in a datagrid. When I add the dropdown, I expect the code-behind
file to be updated by VS. It should be updated to contain a type
declaration
for the new dropdown with a variable name that is the same as the id that
I
set in the designer.
Do I expect correctly?
Well, it's not happening. And it doesn't matter whether it's an HTML or a
web control. The type declaration is not being generated automatically.
If
I add the declaration manually, it fools the compiler but not the runtime.
I think there may be something important here that I do not understand.
Can
anyone tell me what I need to read about in order to debug this situation?
Thanks.