Hi, I have the the GridView's column looking like that:
<Columns>
<asp:TemplateField HeaderText="Opcje">
<ItemTemplate>
<asp:LinkButton runat="server" Text="Accept" ID="AcceptBtn" CommandName="Accept"/>
<asp:LinkButton runat="server" Text="Deny" ID="DenyBtn" CommandName="Deny"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
while a new row is being created, I want to change both LinkButton's CommandArgument property:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
((LinkButton)e.Row.FindControl("AcceptBtn")).CommandArgument = myFiles[fileIndex].Name;
((LinkButton)e.Row.FindControl("DenyBtn")).CommandArgument = myFiles[fileIndex].Name;
}
The problem is, the code seems to be not changing anything, when I click on the AcceptBtn, the code below is invoked:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Accept")
{
string ss = (string)e.CommandArgument;
...
}
}
ss = "". Why ? If the page is PostedBack, both CommandArguments are cleared ?