I am using 2 linkbuttons inside seperate dataitem server controls on my asp.net web page
<asp:LinkButton ID="Item1" runat="server" CommandName="first"
OnCommand="Item1_Onclick" CommandArgument="<%# Container.DataItem %`>"
Text="<%# Container.DataItem %`>" >
</asp:LinkButton`>
and
<asp:LinkButton ID="Item2" runat="server" CommandName="second"
OnCommand="Item2_Onclick" CommandArgument="<%# Container.DataItem %`>"
Text="<%# Container.DataItem %`>" >
</asp:LinkButton`>
When I extract the command name inside c# as
e.CommandArgument.ToString().Trim();
it does give me the correct the name however the command arugument
e.CommandArgument.ToString().Trim();
for item2 is not what I expect. It is NOT that of item1, but the one that I set initially as datasource for the datalist control of item2. It does not give me the latest dataitem string value that I am expecting out of item2 linkbutton. What can be the problem? Where am I wrong?
Also, the event for item2 is fired ONLY for the first time and not after that? Is there some silly mistake that I am doing?