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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:41:24+00:00 2026-06-11T02:41:24+00:00

im working on an asp.net website with c#. I have a dropdownlist with data

  • 0

im working on an asp.net website with c#.
I have a dropdownlist with data from an sql database. The dropdownlist is on a gridview.

The dropdownlist is inside a templatefield, on the edititemtemplate.

The data is loaded on the dropdownlist and once a link button is pressed the dropdownlist is enabled for editing, with the corresponding value, ………….but also all the other values from the column from the database are loaded there(this last thing is something I dont want).

The dropdownlist is binded on the GridView1_RowDataBound event:

Control ctrlgridMonedaEdit = e.Row.FindControl("gridMonedaEdit");
            if (ctrlgridMonedaEdit != null)
            {
                DropDownList dd = ctrlgridMonedaEdit as DropDownList;
                //more code here
                dd.DataSource = dt;
                dd.DataValueField = "Moneda";
                dd.DataTextField = "Moneda";
                dd.DataBind();
                DataRowView rowView = (DataRowView)e.Row.DataItem;
                string tempDate = rowView["Moneda"].ToString();
                dd.SelectedIndex = dd.Items.IndexOf(dd.Items.FindByText(tempDate));
                sqlConn.Close();
            }

What I want is 3 values which must load when the dropdownlist is enabled for editing. And also that the corresponding value stay selected.
I have tried this:

<EditItemTemplate>
      <asp:DropDownList Width="90" runat="server" id="gridMonedaEdit" AutoPostBack="true" Enabled ="true"   >
         <asp:ListItem Value="MONEDA"> MONEDA </asp:ListItem>
                  <asp:ListItem Value="USD"> USD </asp:ListItem>
                  <asp:ListItem Value="MONEDA/USD"> MONEDA/USD </asp:ListItem>
      </asp:DropDownList>                          
</EditItemTemplate>

But these values do not show up.

How can I solve this?

  • 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-11T02:41:25+00:00Added an answer on June 11, 2026 at 2:41 am

    I’d insert the static list items in the code behind after calling dataBind() on your dropdownlist.

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

Sidebar

Related Questions

I am working on an ASP.Net website and have a GridView displaying some data,in
I'm working on asp.net website with Vb.net and I have a dropdownlist with autopostback
I have an asp.net website that stores events inside a database table. Then I
I am working on ASP.Net 2.0 website and I have a strange problem. First
I am working on an ASP.NET website with sql server 2008 R2. i need
I'm working on an ASP.Net project to display information on a website from a
I am trying to send an outlook appointment from an ASP.NET website. I have
I am currently working on an ASP.NET MVC3 website. I have a simple authentication
I'm working on a asp.net website and I have created a user control where
I have been working on a multilingual website which has been developed in ASP.net

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.