DroDownList loose binding in Template

2 posts, 0 answers
  1. Felice
    Felice avatar
    198 posts
    Member since:
    Aug 2013

    Posted 15 Apr 2014 Link to this post

    I have 3 dropDownList in my grid, all bind to Sql tables with SqlDatasource. The first one "Pnum" acts like I need, i.e. when a value is selected it stays there even when I re-open the record for modification. The other two "minutes" and "hours" behave in a different way, I mean every time I open the record for modification, the selected value is set to the first one in the db or nothing.

    This is the good one:

    <EditFormSettings EditFormType="Template">
    <table class="table">
    <telerik:RadDropDownList ID="RadDropDownList1" runat="server"
    DataSourceID="SqlDataSource2" DataTextField="Pnum" DataValueField="Pnum"
    SelectedValue='<%#Bind("Pnum") %>' Skin="Outlook" AutoPostBack="true">

    These two give me the problem:

    <telerik:RadDropDownList ID="RadDropDownList2" runat="server" DataSourceID="SqlDataSource3"
    DataTextField="minutes" DataValueField="minutes" SelectedValue='<%#Bind("minutes") %>'
    Skin="Outlook" AutoPostBack="true">
    <telerik:RadDropDownList ID="RadDropDownList3" runat="server" DataSourceID="SqlDataSource4"
    DataTextField="hours" AutoPostBack="false" DataValueField="hours"
    SelectedValue='<%#Bind("hours") %>' Skin="Outlook">

    I do not see any difference that may cause such different behavior. Any hint on how to solve this problem? I mean, avoid that the value is changed when opening the record for modification.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Apr 2014 in reply to Felice Link to this post

    Hi Felice,

    Unfortunately I couldn't replicate the issue at my end. Please have a look into the sample code snippet which works fine at my end.

    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false">
                <telerik:GridBoundColumn DataField="OrderID" UniqueName="OrderID">
                <telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID">
                <telerik:GridBoundColumn DataField="OrderDate" UniqueName="OrderDate">
                <telerik:GridBoundColumn DataField="EmployeeID" UniqueName="EmployeeID">
                <telerik:GridBoundColumn DataField="ShipName" UniqueName="ShipName">
            <EditFormSettings EditFormType="Template">
                    <telerik:RadDropDownList ID="RadDropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="CustomerID" DataValueField="CustomerID" SelectedValue='<%#Bind("CustomerID") %>' Skin="Outlook" AutoPostBack="true">
                    <telerik:RadDropDownList ID="RadDropDownList2" runat="server" DataSourceID="SqlDataSource1" DataTextField="EmployeeID" DataValueField="EmployeeID" SelectedValue='<%#Bind("EmployeeID") %>' Skin="Outlook" AutoPostBack="true">
                    <telerik:RadDropDownList ID="RadDropDownList3" runat="server" DataSourceID="SqlDataSource1" DataTextField="ShipName" DataValueField="ShipName" SelectedValue='<%#Bind("ShipName") %>' Skin="Outlook" AutoPostBack="true">

    Please provide your full code if it doesn't help.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top