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 8836357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:28:35+00:00 2026-06-14T09:28:35+00:00

How can i get row index of the grid view whose child control is

  • 0

How can i get row index of the grid view whose child control is doing post back. I know the way of getting control causing post back and finding its parent container which returns grid view row and then find its index. I want this in a RowDataBound event to check selectedrow index and formatting the same. Is there any other property or settings which directly emits selected index of the grid view on any child control post back

Edit:

For example if there is a dropdownlist in a row and there are certain rows in a gridview. Then i want gridview rowindex where postback happens due to that dropdowlist in the gridview row.

  • 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-14T09:28:36+00:00Added an answer on June 14, 2026 at 9:28 am

    You can get the index of the row in RowDataBound via the RowIndex property:

    protected void gridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int index = e.Row.RowIndex;
        }
    }
    

    You can get the index of any child control in a GridView via

    • childControl.NamingContainer =>
    • GridViewRow =>
    • RowIndex

    for example in a DropDownList.SelectedIndexChanged event:

    protected void DropDownList1_SelectedIndexChanged(Object sender, EventArgs e)
    {
        DropDownList ddl = (DropDownList) sender;
        GridViewRow row  = (GridViewRow)  ddl.NamingContainer;
        int index        = row.RowIndex;
    }
    

    Finally: since you’ve mentioned ” to check selectedrow index”, if you’re actually looking for the selected row index of the GridView itself, there’s a property just for this:

    • GridView.SelectedIndex Property
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can get the current selected row in this way: private void DataGridView1_CellContentClick(object sender,
I have a grid view on a page and the row height can vary.
I can get the the first row in a ListView item in .NET 3.5
I can't get the table row to fade out in IE. It works in
How can I get the Nth row using Linq? both columns are text so
How can I get DateTime value in C# from row, the current code is
How can I get the current selected row for UIPicker? I want to use
Can I run a select statement and get the row number if the items
How can I get the previous version of data of a Row in a
How can I get the 2 biggers numbers of a matrix row? If the

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.