0

I have a gridview and I add a click event to row click:

protected void gvProject_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowIndex != -1)
        if (e.Row.RowType == DataControlRowType.DataRow)
            e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvProject, "Select$" + e.Row.RowIndex);
}

my problem is with check box in gridview, I don't want row click event fire when I check/uncheck my checkbox. how can I do this? I search but I not found anything...

thank you

1 Answer 1

0

I found solution:

I change my rowdatabound event to this:

if (e.Row.RowIndex != -1)
        if (e.Row.RowType == DataControlRowType.DataRow)
            for (int i = 0; i < e.Row.Cells.Count; i++)
                if (i != 0)
                    e.Row.Cells[i].Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvProject, "Select$" + e.Row.RowIndex);

this code skip checkbox cell.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.