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

  • Home
  • SEARCH
  • 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 3666606
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:54:03+00:00 2026-05-19T01:54:03+00:00

In ASP.NET 4, I have a GridView, which contains a DropDownList in the asp:TemplateEdit

  • 0

In ASP.NET 4, I have a GridView, which contains a DropDownList in the asp:TemplateEdit section. The DropDownList is populating with all of the options I need from a second data source. However, I would like to have each DropDownList in each row have a different SelectedIndex set on default based on data already in the GridView.

For example, here is sample data

|  id  |     Status    |  hidden  |  First Name  |
--------------------------------------------------
|  12  |   <dropdown>  |     3    |  john  doe   |
|  13  |   <dropdown>  |     7    |  jane  ble   |

so you will note the 3rd column is hidden, meaning I have it set to:

<asp:BoundField DataField="StatusName" HeaderText="Status" Visible="false" />

However, the edited row in this column contains the value (asp:BoundField) that I need the DropDownList to display by default.

In other words I need

<option select="selected">something</option>

to have the proper index selected based on the number in the "hidden" field.

  • 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-05-19T01:54:04+00:00Added an answer on May 19, 2026 at 1:54 am

    You can subscribe to RowDataBound event in order to select the right value in the drop-down list:

    protected void myGrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DropDownList lst = null;
        string hiddenStatus = string.Empty;
    
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            hiddenStatus = e.Row.Cells[2].Text;
            lst = (DropDownList)e.Row.FindControl("dropDownIdentifier");
    
            lst.SelectedValue = hiddenStatus;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET GridView which is populated from a SQL Server database. This
I need to make a simple asp.net MVC project, which contains a GridView. I
I have an ASP.NET gridview component which is being filled up with data from
I have user control on a ASP.NET web page, which contains a GridView and
I have an ASP.NET(2.0 using C#) web app, in which I have a gridview.
Using asp.net 3.5 Gridview control, visual studio 2008. I have played with all the
I am using C#,ASP.NET I have a Gridview for which I have provided Sorting,
I have an asp.net gridview which is output as a table in HTML. There's
I have gridview in my asp.net 3.5 application [C#]. Which looks like this: <asp:GridView
I have an ASP.NET GridView that's bound to an ObjectDataSource (which is bound to

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.