Hello everyone, i have multiple link buttons in gridview and have to write event for selected link button. All buttons are fire different query and output will be send on another page.
This is my HTML code:
AutoGenerateColumns="False" CssClass="Grid" ondatabound="GridView1_DataBound"
onrowcreated="GridView1_RowCreated" onrowdatabound="GridView1_RowDataBound"
onselectedindexchanged="GridView1_SelectedIndexChanged" Width="152px"
onrowcommand="GridView1_RowCommand">
C# Code:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "sd")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
if (row.Cells[1].Text != " ")
{
e.Row.Cells[1].Attributes.Add("onClick", "openWindow_Requests('" + division + "," + category + "," + month + "," + year + "')");
}
}
}
Thanks in advanced.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Manas MohapatraRank #182 · 13.2K reputationPosted Jan 23, 2017, 8:42 PM EST