locked
Error - System.eventarguments does not contain a definition for row RRS feed

  • Question

  • User-1499457942 posted

    Hi

      On below code on Row i get above error

    protected void gvw_RowDataBound(object sender, EventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.Header)
    {
    e.Row.Cells[3].ColumnSpan = 2;
    e.Row.Cells[4].Visible = false;
    e.Row.Cells[3].Text = "Action";
    }
    }

    Thanks

    Monday, August 6, 2018 2:44 PM

Answers

  • User475983607 posted

    The event handler signature is not correct for a RowDataBound event.   According to the openly published documentation the handler have GridViewRowEventArgs not EventArgs.

    https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound(v=vs.110).aspx

    protected void gvw_RowDataBound(object sender, GridViewRowEventArgs e)
    {

    Usually Visual Studio writes the correct handler signature to the code behind.  If you wish to write your own, then please start reading the documentation to make sure you are using the proper syntax.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 6, 2018 2:53 PM