manojs
02-24-2007, 11:52 PM
First off , thanks for your time...
I have a datalist control in my page.
<asp:DataList ID="DataList1" runat="server" DataKeyField="ID" DataSourceID="AccessDataSource3"
Style="z-index: 102; position: relative; top: 3px;" SelectedItemStyle-BackColor="yellow" SelectedIndex="1" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" OnItemCommand="DataList1_ItemCommand"
>
</asp:AccessDataSource>
And the DataList1_ItemCommand function is as follows
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
string cmd = e.CommandName;
if (cmd == "select")
{
DataList1.SelectedIndex = e.Item.ItemIndex;
}
}
The error I get is that DataList1 does not exist in the current context...This happens even if I put the statement in the Page_Load function..Should i set the control to public someplace coz all I did was to drag and drop the control onto the form...Thanks again for any suggestions...
M
I have a datalist control in my page.
<asp:DataList ID="DataList1" runat="server" DataKeyField="ID" DataSourceID="AccessDataSource3"
Style="z-index: 102; position: relative; top: 3px;" SelectedItemStyle-BackColor="yellow" SelectedIndex="1" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" OnItemCommand="DataList1_ItemCommand"
>
</asp:AccessDataSource>
And the DataList1_ItemCommand function is as follows
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
string cmd = e.CommandName;
if (cmd == "select")
{
DataList1.SelectedIndex = e.Item.ItemIndex;
}
}
The error I get is that DataList1 does not exist in the current context...This happens even if I put the statement in the Page_Load function..Should i set the control to public someplace coz all I did was to drag and drop the control onto the form...Thanks again for any suggestions...
M