How can I get the DropDown List value from the Database

2 posts, 1 answers
  1. Perry
    Perry avatar
    62 posts
    Member since:
    Jul 2015

    Posted 29 Jun 2018 Link to this post

    I have a problem That I need help with.  I have a simple grid using all GridBoundColumns, except for 2 dropdown lists.

    AllowAutoInsert and Updates are enabled so I do not do any code to show the value when I do an update.  All of my fields that are using a GridBoundColumn show the proper values from the database.  Except for  the 2 drop downs.  Both of DropDowns show no value at all.

    Note the dropdowns do work and I can select a value, but the data from the database is not shown.  Can anyone please tell me how or provide a link that shows how I can get these values to populate the drop downs?

     

    I have attached a screen shot that shows the form in edit mode

    Thanks

  2. Answer
    Vessy
    Admin
    Vessy avatar
    2214 posts

    Posted 04 Jul 2018 Link to this post

    Hi Perry,

    I tested the described scenario with  the following demo (just changing the RenderMode="Classic") and the DropDownList is properly bound at my end. You can examine its markup in the source code of the demo and see whether it differs your actual configuration:
    https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx

    Namely:
    <asp:DropDownList ID="ddlTOC" runat="server" SelectedValue='<%# Bind("TitleOfCourtesy") %>'
        DataSource='<%# (new string[] { "Dr.", "Mr.", "Mrs.", "Ms." }) %>' TabIndex="7"
        AppendDataBoundItems="True">
        <asp:ListItem Selected="True" Text="Select" Value="">
        </asp:ListItem>
    </asp:DropDownList>


    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top