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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:26:58+00:00 2026-06-03T05:26:58+00:00

I am trying to add a column with dropdownlist to a DataGrid Here is

  • 0

I am trying to add a column with dropdownlist to a DataGrid

Here is the code for the DataGrid binding datasource

        List<CPDEmployee> employeelist = (List<CPDEmployee>)Cache["EmployeeList"];

        unverifiedlist.DataSource = employeelist;
        unverifiedlist.DataBind();
        unverifiedlist.AllowPaging = true;
        unverifiedlist.PageSize = 10;

In the page.aspx code is like this

 <asp:DataGrid ID="unverifiedlist" runat="server" AllowPaging="true" PageSize="10" OnPageIndexChanged="unverifiedlist_PageIndexChanged">
            <Columns>
                <asp:BoundColumn HeaderText="Surname" DataField="Surname" ReadOnly="true">   
                </asp:BoundColumn>
            </Columns>
            <Columns>
                <asp:TemplateColumn HeaderText="Options" >
                    <ItemTemplate>
                        <asp:DropDownList ID="options" runat="server">
                            <asp:ListItem Value="1">Verified</asp:ListItem>
                            <asp:ListItem Value="0">Rejected</asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText ="Reason">
                    <ItemTemplate>
                        <asp:TextBox ID="reason" runat="server"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>

enter image description here

The result is there are two "Surname" fields in the datagrid. The reason I added "Surname" from page side is that i can’t set the order of the columns (the dropdownlist should be at last).

Does anyone know how to solve this problem? thanks very much

  • 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-03T05:26:59+00:00Added an answer on June 3, 2026 at 5:26 am

    You have to turn off AutoGenerateColumns and specify all the bound fields.

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

Sidebar

Related Questions

Here is my webgrid .I am trying to add a column EndDate which displays
I'm trying to add a custom filter to my RadGrid. I have a column,
Trying to add a class object into a List using reflection, but when invoking
I'm trying to add column to ASPxGridView which would have link to other page:
I am getting the following error while trying to add a NOT NULL column
I'm trying to write this transaction where I'm trying to add a column to
I am currently trying to add a custom column name to a property in
I am trying to add a column to my existing users table but it
I am using MySQL 5.1. When i am trying to add new column, it
I am a NOVICE SQL ADMIN... I am trying to add a column 'ID'

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.