Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with DataList

Status
Not open for further replies.

rgordon

Programmer
Apr 10, 2003
1
GB
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=&quot;2&quot;>
<asp:DataList id=&quot;NewsDataList&quot; runat=&quot;server&quot;>
<ItemTemplate>
<asp:ImageButton id=&quot;ImageButton1&quot; runat=&quot;server&quot; ImageUrl=&quot;../images/news_edit.gif&quot; CommandName=&quot;EditNews&quot;>
</asp:ImageButton>
<A class=&quot;newstitles&quot; href=&quot;javascript:;&quot;>
<%# DataBinder.Eval(Container.DataItem, &quot;news_headline&quot;)%>
</A>
<br>
<SPAN class=&quot;newsstory&quot;>
<%# DataBinder.Eval(Container.DataItem, &quot;news_story&quot;)%>
</SPAN>
</ItemTemplate>
</asp:DataList>
</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 &quot;NewsDataList_ItemCommand&quot; is ever made.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top