B
Ben
Hi,
In the code-behind, i can refer to the dropdownlist defined in the aspx file
with this (e.g.)
dropdownlist1.sekectedvalue = ...
but why can i not refer to the label defined in the TemplateField in the
same aspx file like below?
This gives the error: "can't find control 'mylabel' ":
mylabel.text="ok"
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="mylabel" Runat="server"
Text='<%# Bind("field1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<aspropDownList ID="dropdownlist1" runat="server" AutoPostBack="True" >
</aspropDownList>
Thanks
Ben
In the code-behind, i can refer to the dropdownlist defined in the aspx file
with this (e.g.)
dropdownlist1.sekectedvalue = ...
but why can i not refer to the label defined in the TemplateField in the
same aspx file like below?
This gives the error: "can't find control 'mylabel' ":
mylabel.text="ok"
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="mylabel" Runat="server"
Text='<%# Bind("field1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<aspropDownList ID="dropdownlist1" runat="server" AutoPostBack="True" >
</aspropDownList>
Thanks
Ben