Greetings,
Can someone please clue me on how to load data into a DropDownList that is located with a SelectedItem Template? The ItemTemplate contains a LinkButton. However, attempting to populate the DropDownList prior to the LinkButton's Click event ending will produce the "...not set to the instance of an object..." error.
I thought I could put something in the Page_Load() event, but I can't reference a control that, technically, doesn't exist yet.
I understand how to do the actual database stuff. I just need to know how to correctly reference the DropDownList in order to load data into it.
Thanks
Can someone please clue me on how to load data into a DropDownList that is located with a SelectedItem Template? The ItemTemplate contains a LinkButton. However, attempting to populate the DropDownList prior to the LinkButton's Click event ending will produce the "...not set to the instance of an object..." error.
I thought I could put something in the Page_Load() event, but I can't reference a control that, technically, doesn't exist yet.
Code:
<asp:DataList ID="dlst_Test" OnItemCommand= "dlstTest_ItemCommand" Runat="Server">
<HeaderTemplate>
<table>
<tr>
<td>Requirement</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:LinkButton Text='<%# Container.DataItem( "J_Name" ) %>' Runat="Server" /></td>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<tr>
<td><asp:DropDownList id="drpJ_Name" OnSelectedIndexChanged="drpJ_Name_SelectedIndexChanged" AutoPostBack="True" Runat="Server">
</asp:DropDownList></td>
</tr>
</SelectedItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
I understand how to do the actual database stuff. I just need to know how to correctly reference the DropDownList in order to load data into it.
Thanks