This is a migrated thread and some comments may be shown as answers.

DroDownList loose binding in Template

1 Answer 27 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Felice
Top achievements
Rank 1
Felice asked on 15 Apr 2014, 12:09 PM
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">
<FormTemplate>
<table class="table">
.........
<telerik:RadDropDownList ID="RadDropDownList1" runat="server"
DataSourceID="SqlDataSource2" DataTextField="Pnum" DataValueField="Pnum"
SelectedValue='<%#Bind("Pnum") %>' Skin="Outlook" AutoPostBack="true">
</telerik:RadDropDownList>


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>
 
<telerik:RadDropDownList ID="RadDropDownList3" runat="server" DataSourceID="SqlDataSource4"
DataTextField="hours" AutoPostBack="false" DataValueField="hours"
SelectedValue='<%#Bind("hours") %>' Skin="Outlook">
</telerik:RadDropDownList>
.......
</table>
 </FormTemplate>
</EditFormSettings>


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.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Apr 2014, 05:26 AM
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.

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

Please provide your full code if it doesn't help.
Thanks,
Princy.
Tags
DropDownList
Asked by
Felice
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or