DataList ItemCommand Event Not wortking !! Please help Guys :((
-
Hi im having an issue with the DataList control not firing the ItemCommand event. here is my code : Snippet 1 (attempt : 1 does not work :( ) <asp:Literal ID="litSortBy" runat="server" Text="<%$ Resources:language_resource, sort_by %>" />: <asp:ListView ID="lvSort" runat="server" OnItemDataBound="lvSort_ItemDataBound" OnItemCommand="lvSort_ItemCommand" > <LayoutTemplate> <asp:PlaceHolder ID="itemPlaceHolder" runat="server" /> </LayoutTemplate> <ItemTemplate> <asp:LinkButton ID="lbtnSort" runat="server" /> <asp:Literal ID="litSpacer" runat="server" Text=" | " /> </ItemTemplate> </asp:ListView> Snippet 2 (attempt : 2 does not work :( ) // Manually registering the events in the codebehind still dont solve anything DataList.ItemCommand +=new EventHandler<ListViewCommandEventArgs>(lvSort_ItemCommand); // Here is the codebeind: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindDataListNavigationProducts(); GetNavigationInfo(); BindSortingOptions(); } } protected void lvSort_ItemCommand(object sender, ListViewCommandEventArgs e) { // Never ever gets here, why what going on here ????? } Can someone please offer an alternavtive solution or a work around this ? Thank you very much in advance. :-)
Wisdom is often meant as the ability and desire to make choices that can gain approval in a long-term examination by many people.