Hi,
I seem to be having a problem getting an ItemCommand event from a imagebutton nested inside a datalist. Any ideas would be greatly appreciated.
I have the following code within my aspx page
<td colspan="2">
<aspataList id="NewsDataList" runat="server">
<ItemTemplate>
<asp:ImageButton id="ImageButton1" runat="server" ImageUrl="../images/news_edit.gif" CommandName="EditNews">
</asp:ImageButton>
<A class="newstitles" href="javascript:;">
<%# DataBinder.Eval(Container.DataItem, "news_headline"%>
</A>
<br>
<SPAN class="newsstory">
<%# DataBinder.Eval(Container.DataItem, "news_story"%>
</SPAN>
</ItemTemplate>
</aspataList>
</td>
Visual Studio has added the following code to my default.aspx.cs file :-
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnAddNews.Click += new System.Web.UI.ImageClickEventHandler(this.btnAddNews_Click);
this.NewsDataList.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.NewsDataList_ItemCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
But basically whenever I click on the imagebutton no call to "NewsDataList_ItemCommand" is ever made.
I seem to be having a problem getting an ItemCommand event from a imagebutton nested inside a datalist. Any ideas would be greatly appreciated.
I have the following code within my aspx page
<td colspan="2">
<aspataList id="NewsDataList" runat="server">
<ItemTemplate>
<asp:ImageButton id="ImageButton1" runat="server" ImageUrl="../images/news_edit.gif" CommandName="EditNews">
</asp:ImageButton>
<A class="newstitles" href="javascript:;">
<%# DataBinder.Eval(Container.DataItem, "news_headline"%>
</A>
<br>
<SPAN class="newsstory">
<%# DataBinder.Eval(Container.DataItem, "news_story"%>
</SPAN>
</ItemTemplate>
</aspataList>
</td>
Visual Studio has added the following code to my default.aspx.cs file :-
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnAddNews.Click += new System.Web.UI.ImageClickEventHandler(this.btnAddNews_Click);
this.NewsDataList.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.NewsDataList_ItemCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
But basically whenever I click on the imagebutton no call to "NewsDataList_ItemCommand" is ever made.