locked
How to select a row in editable gridview RRS feed

  • Question

  • User520710431 posted

    Hi All,

        How to select a row in  editable gridview, if we write like


    protected void GvTimeEntry_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(GvTimeEntry, "Select$" + e.Row.RowIndex.ToString()));
            }
        }

    its selecting the row in gridview but it unable to select dropdown and image in gridview after selecting a row in gridview


    My requirement is selecting a row in gridview and when the user selects a row in gridview, it has to perform postback to show the data in other controls related to this gridview row and able to select dropdownlist and imagebuttons in gridview.

    Note: I have used checkbox in gridview to select rows and delete selected rows, but i want postback has to be happen show the data of gridview rows in other controls.


    Thanks in advance...

    Monday, November 15, 2010 6:43 AM

Answers

  • User191633014 posted

    add :

        protected void GvTimeEntry_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            GridView g = (GridView)sender;
            if (g.SelectedRow != null)
                g.SelectedRow.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(g, "Select$" + g.SelectedRow.RowIndex.ToString()));
            g.Rows[e.NewSelectedIndex].Attributes.Remove("onclick");
        }


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 15, 2010 8:28 AM