Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8760329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:00:58+00:00 2026-06-13T15:00:58+00:00

I have a nested gridview. I have defined gridview_RowDeleting event for the nested gridview.but

  • 0

I have a nested gridview. I have defined gridview_RowDeleting event for the nested gridview.but I have a problem , when I want to delete ,for example,first row in the nested gridview and this nested gridview is in secound or third,..row of parent gridview , I can not delete row in the nested gridview and e.RowIndex for parent gridview is also 0 while it should be 1 or 2,..and for nested gridview it should be 0.

please help how I have to change my code can recognize e.RowIndex for parent gridview is different of e.RowIndex nested gridview.

protected void GridViewTranstoCon_RowDeleting(object sender, GridViewDeleteEventArgs e)
{


    GridView TranstoCon = sender as GridView ;
    int transid = Convert.ToInt32(GridViewTtransmittals.DataKeys[e.RowIndex].Value);

    int Id = Convert.ToInt32(TranstoCon.DataKeys[e.RowIndex].Value);

    //Also step into this and see what it's doing
    OnDeleteTtransmittaltocon(Id,transid);

GridViewTtransmittals is parent gridview and TranstoCon is nested gridview.

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:00:59+00:00Added an answer on June 13, 2026 at 3:00 pm

    the problem is that you are using nested gridview’s RowIndex for parent gridview . in this event e.RowIndex refers to nested gridview‘s current row not it’s parent’s . to get parent gridview’s current row’s index :

    GridViewRow parentRow = (GridViewRow)TranstoCon.Parent.Parent.Parent;
    int parentRowIndex = parentRow.RowIndex;
    

    I’m not quite sure either two or three .Parent is required . you can try both .

    so your code could be edited as below :

    protected void GridViewTranstoCon_RowDeleting(object sender, GridViewDeleteEventArgs e){
    GridView TranstoCon = sender as GridView ;
    
    // parent row
    var parentRow = (GridViewRow)TranstoCon.Parent.Parent.Parent;
    
    int transid = Convert.ToInt32(parentRow.DataKeys[parentRow.RowIndex].Value);
    
    
    int Id = Convert.ToInt32(TranstoCon.DataKeys[e.RowIndex].Value);
    
    //Also step into this and see what it's doing
    OnDeleteTtransmittaltocon(Id,transid);
    }
    

    you can check this post

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Repeater nested inside of a GridView . On the RowDataBound event
I have come across odd behavior involving nested gridview controls and row events. Basically
I want to design a nested gridview with insert, update, delete functionality through custom
I have a blank Repeater nested inside a column in a GridView and want
I have defined a nested grid view in the following way. <asp:GridView ID=GridView1 runat=server
I have a nested gridview in my page. The first one is used like
I have a nested gridview with 45 checkboxes. I want the user to be
I have an ASP Datalist with a nested GridView. I am trying to display
I have a radiobutton column in a gridview, inside many nested asp tables. I
What if I have nested loops, and I want to break out of all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.