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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:27:01+00:00 2026-06-05T01:27:01+00:00

I have a little problem with my gridview. In Editmode I load a dropdownlist

  • 0

I have a little problem with my gridview.
In Editmode I load a dropdownlist with content from my database (foreign key!).
When I save the changes and go after again in the editview, the dropdownlist shows the first entry from the table and not the value from the value that is saved. How can I set the default value in the dropdown to the value, that is set in the database, when I go in the editmode?

I hope my concern is understandable. Thank you very much for helping!

My Code (shorted)

<asp:DetailsView ID="dtvProjektdetails" runat="server" DataSourceID="sqlProjectDetails" AutoGenerateRows="False" DataKeyNames="ProjectID" DefaultMode="Edit" onitemupdating="dtvProjektdetails_ItemUpdating">
<Fields>
   <asp:TemplateField HeaderText="Segment" SortExpression="FK_Segment">
      <EditItemTemplate>
         <asp:DropDownList ID="ddlSegment" runat="server" DataSourceID="sqlDSSegment" DataTextField="Segment" DataValueField="SegID">
         </asp:DropDownList>
      </EditItemTemplate>
   </asp:TemplateField>
</Fields>
</asp:DetailsView>

Datasource of the Dropdown (shorted)

<asp:SqlDataSource ID="sqlDSSegment" runat="server" ConnectionString="<%$ ConnectionStrings:CSLinker %>" SelectCommand="SELECT * FROM [tabSegment] ORDER BY Segment]"></asp:SqlDataSource>

Datasource of the Detailview:

<asp:SqlDataSource ID="sqlProjectDetails" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CSLinker %>" 
        SelectCommand="SELECT * FROM [tabProjects] WHERE ([ProjectID] = @ProjectID)" 
        UpdateCommand="UPDATE [tabProjects] SET [Name] = @Name, [ProejctNo] = @ProejctNo, [Startdate] = @Startdate, [Enddate] = @Enddate, [FK_Owner] = @FK_Owner, [FK_Segment] = @FK_Segment, [FK_ProjectCategorie] = @FK_ProjectCategorie, [FK_ProjectFiles] = @FK_ProjectFiles, [FK_Mailings] = @FK_Mailings, [Botschaft] = @Botschaft, [Ziel] = @Ziel, [Callmenge] = @Callmenge, [Quote] = @Quote, [Zielgruppe] = @Zielgruppe, [Inboundnummer] = @Inboundnummer, [Wissen] = @Wissen, [Prozess] = @Prozess, [Goodies] = @Goodies, [FK_Sprachen] = @FK_Sprachen WHERE [ProjectID] = @ProjectID">
        <SelectParameters>
            <asp:ControlParameter ControlID="lblPID" Name="ProjectID" PropertyName="Text" Type="Int64" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="ProejctNo" Type="String" />
            <%--<asp:Parameter Name="Description" Type="String" />--%>
            <asp:Parameter Name="Startdate" Type="DateTime" />
            <asp:Parameter Name="Enddate" Type="DateTime" />
            <asp:Parameter Name="FK_Owner" Type="Int64" />
            <asp:Parameter Name="FK_Segment" Type="Int64" />
            <asp:Parameter Name="FK_ProjectCategorie" Type="Int64" />
            <asp:Parameter Name="FK_ProjectFiles" Type="Int64" />
            <asp:Parameter Name="FK_Mailings" Type="Int64" />
            <asp:Parameter Name="Botschaft" Type="String" />
            <asp:Parameter Name="Ziel" Type="String" />
            <asp:Parameter Name="Callmenge" Type="String" />
            <asp:Parameter Name="Quote" Type="String" />
            <asp:Parameter Name="Zielgruppe" Type="String" />
            <asp:Parameter Name="Inboundnummer" Type="String" />
            <asp:Parameter Name="Wissen" Type="String" />
            <asp:Parameter Name="Prozess" Type="String" />
            <asp:Parameter Name="Goodies" Type="String" />
            <asp:Parameter Name="FK_Sprachen" Type="Int64" />
            <%--<asp:Parameter Name="FK_Agenten" Type="Int64" />--%>
            <asp:Parameter Name="ProjectID" Type="Int64" />
        </UpdateParameters>
    </asp:SqlDataSource>
  • 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-05T01:27:02+00:00Added an answer on June 5, 2026 at 1:27 am

    Set the selectedvalue – property of the dropdownlist:

    <asp:DropDownList ID="ddlLinkCategorie" runat="server" DataSourceID="sqlDScategorie"
                                DataTextField="Categorie" DataValueField="LinCatID" selectedvalue='<%Bind("columnName")%>'>
                            </asp:DropDownList>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem, I am building a database from CSV files using
I have a little problem with memory management in my iOS App. I load
i have little problem in using my application application having msaccess database if i
I have a little problem. I have a window that the main content is
I have a little problem. I want to pass two variables from PHP to
I have a little problem with multiline UILabel, my UILabel text like starts from
I have a little problem with a Listview. I can load it with listview
I'm have little problem in retrieving the data from a table here's the code:
I have 'little' problem with javascript numbers and NaN . I'm retrieving one single
I have little problem with a replacement of a little part in an url.

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.