GridView Update doesnt seem to work

Discussion in 'ASP .Net Web Controls' started by sri_san@mailcity.com, Nov 29, 2006.

  1. Guest

    Hello,
    I have a gridview in a usercontrol which is inside another
    usercontrol. I am facing a problem when I click on "Update" in the
    sense, inside the onRowUpdating event - the gridview.editindex is -1
    and is unable to find the controls from the edittemplate. The same
    flow works fine when the gridview is coded in a aspx page instead of
    inside a nested usercontrol. The controls are declared in the html view
    and is not dynamic.
    The code is outlined as below:
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!Page.IsPostBack)
    {
    bindData();
    }
    }
    protected void newsGridView_RowEditing(object sender,
    GridViewEditEventArgs e)
    {
    newsGridView.EditIndex = e.NewEditIndex;
    bindData();
    }
    protected void newsGridView_RowUpdating(object sender,
    GridViewUpdateEventArgs e)
    {
    // In here, the gv.editIndex is reset to -1 with
    gv.Rows.Count =0.
    TextBox txtInput =
    (TextBox)(gvStudents.Rows[e.RowIndex].FindControl("txtInput"))).Text);

    }

    The intriguing part is the same code works fine on a aspx page.

    Any help would be appreciated!


    Thanks,
    Sam
    , Nov 29, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J Rieggle
    Replies:
    1
    Views:
    448
    Curt_C [MVP]
    Jul 21, 2005
  2. Ryan
    Replies:
    1
    Views:
    433
    =?Utf-8?B?TWFydGlu?=
    Sep 20, 2006
  3. xmlhelp
    Replies:
    9
    Views:
    427
    Joseph Kesselman
    Oct 20, 2006
  4. Replies:
    3
    Views:
    417
    alex23
    May 27, 2008
  5. RIP

    CDONTS doesnt seem to work

    RIP, Feb 15, 2004, in forum: ASP General
    Replies:
    2
    Views:
    92
    Roland Hall
    Feb 15, 2004
Loading...

Share This Page