ASP.net C# - Dropdown List

  • I am working to get a drop down to work in a DetailsView with the intent to show the current value from a dataset, along with other additional values so that users can edit the data.  In this example, this is a for State drop down.  If my current state is DC, than I want DC to display with all other states following in the drop down.  However, I cannot seem to get this to work without errors.

    What this does is get the drop of state to select from, but I am unable to display the current value as default.

    <asp:TemplateField HeaderText="State" SortExpression="">

    <EditItemTemplate>

    <asp:DropDownList ID="ddlState" runat="server" DataSourceID="dsState" DataTextField="Abbrv" DataValueField="Abbrv" AppendDataBoundItems = "true">

    </asp:DropDownList>

    <asp:SqlDataSource ID="dsState" runat="server" ConnectionString="<%$ ConnectionStrings:T2DKLR %>" SelectCommand="SELECT [StateID], [Abbrv] FROM [State] ORDER BY [Abbrv]"></asp:SqlDataSource>

    </EditItemTemplate>

    </asp:TemplateField>

    Many thanks in advance for any insights.

     

     

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply