This is my .aspx page
<asp:ListView ID="ListViewGSMatches" runat="server" SelectMethod="ListViewGSMatches_GetData" DataKeyNames="id" UpdateMethod="ListViewGSMatches_UpdateData">
<LayoutTemplate>
.
.
.
</LayoutTemplate>
<ItemTemplate>
.
.
.
</ItemTemplate>
<EditItemTemplate>
<asp:ListView ID="ListViewPlayerStatisticsHome" runat="server" DataSource='<%# GetPlayerStatistics(Eval("participant1Id"), Eval("id"))%>' DataKeyNames="id" OnItemCommand="ListViewPlayerStatisticsHome_OnItemCommand">
<LayoutTemplate>
<span>Off. Statistics</span>
<asp:TextBox runat="server" ID="TxbOffensiveStatistics"></asp:TextBox>
<span>Def. Statistics</span>
<asp:TextBox runat="server" ID="TxbDefensiveStatistics"></asp:TextBox>
<asp:Button runat="server" Text="Update" ID="UpdateButton" CommandName="UpdateStatistics" CommandArgument='<%# Eval("matchId") + "/2" %>' ClientIDMode="Static" />
</LayoutTemplate>
<ItemTemplate>
.
.
.
</ItemTemplate>
</asp:ListView>
</EditItemTemplate>
</asp:ListView>
And this is .cs file
protected void ListViewPlayerStatisticsHome_OnItemCommand(object sender, ListViewCommandEventArgs e)
{
var ca = e.CommandArgument;
var cn = e.CommandName;
}
My problem is that CommandArgument is empty string when using CommandArgument='<%# Eval("matchId") + "/2" %>'
. When i set CommandArgument like this: CommandArgument="1"
, i can access CommandArgument in code behind.
I also tried onCLick event, but again, CommandArgument was empty when using databinding expression.
Why is databinding not working for me in this case ? Is it because of nested ListView ?(I have found many examples using databinding expression to set commandArgument)
Blockquote