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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:00:45+00:00 2026-06-02T10:00:45+00:00

I am using C# ASP.net, and relative new to it, and need to accomplish

  • 0

I am using C# ASP.net, and relative new to it, and need to accomplish below.

In my VS2010 web application project I have webform with a Gridview which fetches the data from a table.

In the Grid, I have Commandfiled Button (column1) and Item template with Dropdownlist (column2).

Use case is, user first selects one listitem from 3 list items (H, L and M) and then selects command button.

I am not able to figure out how to extract selected listitem from a selected row

protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{

    GridViewRow row = GridView2.SelectedRow;
    Label4.Text = "You selected " + row.Cells[4].Text + "."; 
    Label5.Text = "You selected this list item from dropdownlist " + ???? ; 
}

Thanks in advance.

  • 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-02T10:00:47+00:00Added an answer on June 2, 2026 at 10:00 am

    The GridViewRow object provides the method FindControl (as do all container controls) to get access to a control in the row by its id. For example, if your DropDownList has an id of MyDropDown, you could use the following to access its selected value:

    GridViewRow row = GridView2.SelectedRow;
    DropDownList MyDropDown = row.FindControl("MyDropDown") as DropDownList;
    string theValue = MyDropDown.SelectedValue;
    // now do something with theValue
    

    This is the recommended method for accessing all controls in your GridView. You want to avoid doing things like row.Cells[#] as much as possible, because it easily breaks when you re-arrange or add/remove columns from your GridView.

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

Sidebar

Related Questions

I am using C# ASP.net, and relative new to it, and need to accomplish
Using asp.net 3.5 Gridview control, visual studio 2008. I have played with all the
Using ASP.NET VB, I have a form with some text boxes and a Gridview.
I have a website using asp.net mvc in which I need to embed a
I am using c#, asp.net and working on a web application. I initially had
I'm developing a web application with asp.net and I have a file called Template.docx
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on
Using ASP.NET MVC + jQuery : I need to use some values owned by
Using ASP.Net, I have a server control for which i would like to add

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.