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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:28:55+00:00 2026-05-25T06:28:55+00:00

I want to add a dropdownlist to every entry in a gridview. <asp:GridView ID=GridView1

  • 0

I want to add a dropdownlist to every entry in a gridview.

    <asp:GridView ID="GridView1" runat="server"
    AutoGenerateColumns="False" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">

        <Columns>                
          <asp:TemplateField HeaderText="Bank">
            <ItemTemplate>
              <asp:DropDownList ID="DropDown"
                AutoPostBack="true" runat="server"  DataTextField="Name" DataValueField="Name" 
              >
              </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>

        </Columns>
    </asp:GridView>

At the back end i have the following code in order to bind a datatable to that dropdown list.

DataTable reader = BusinessLayer.BusinessLayerHandler.GetBankList();
DropDown.DataSource = reader;
DropDown.DataTextField = "NAME";
DropDown.DataValueField = "NAME";
DropDown.DataBind();

My problem is that the drop down list created at the grid view (DropDown) is not found at the back end as if it doesn’t exist..

What can I do?

  • 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-25T06:28:55+00:00Added an answer on May 25, 2026 at 6:28 am

    The DropDownList will be created for every single item in the GridView, so there can’t be one field for the dropdownlists. Nevertheless, you can retrieve the DropDownList for a single row (e.g. in RowDataBound or RowCreated event)

    protected void grid_RowDataBound(object sender, GridViewRowEventArgs e)
    { 
      if(r.Row.RowType == DataControlRowType.DataRow)
      {
        DropDownList dropdown = e.Row.FindControl("DropDown") as DropDownList;
        if(dropdown != null)
        { /*  your code */ }
      }
    }
    

    Or you can use an event of the DropDownList itself and access the sender parameter.

    <asp:DropDownList ID="DropDown" OnLoad="dropdownLoad" />
    
    protected void dropdownLoad(object sender, EventArgs e)
    { 
      DropDownList dropdown = sender as DropDownList;
      if(dropdown != null)
      { /*  your code */ }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the dropdownlist like this one : <asp:dropdownlist ID =ddlgender runat=server> <asp:ListItem Text=--Please
I want to subclass the built-in DropDownList in ASP.NET so that I can add
I have a dropdownlist.I want to add selected value of it to a hyperlink
I have a website built with ASP.NET (3.5) and want add some level of
I want to add two default options to my dropdowns in asp.net MVC using
I just want an ASP.NET DropDownList with no selected item. Setting SelectedIndex to -1
I have some markup like this: <form id=ddlSelections runat=server> <asp:ScriptManager ID=ScriptManager1 runat=server EnablePartialRendering=true />
I want to do the following: 1: Add two dropdown list in the register.aspx
I want add my custom sidebar next right column all page. Please check this
I have a list of string values that I want add to a hashtable

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.