protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{}
e.commandname =will give you the name of the which command name button is clicked. for e.g.
In Gridview colums we have
asp:ButtonField CommandName="Buy" Text="Buy"
asp:ButtonField CommandName="Sell" Text="Sell"
if (e.CommandName == "Buy")
{
Response.Write("You Bought: " + GridView1.DataKeys[rowIndex].Value);
}
else if (e.CommandName == "Sell")
{
Response.Write("You Sold: " + GridView1.DataKeys[rowIndex].Value);
}
e.CommandArgument:which will be the index of the clicked row within the record set.
No comments:
Post a Comment