I am looking at the the reference online that has this example:
However I am failing to see where the [InsertID] column value is actually used in the second data source. Could you clarify this? This is exactly what I need to do for the project I am working on.
Thanks
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<$ ConnectionStrings>" SelectCommand="SELECT [ID] as [DataKeyID], [ID] as [InsertID], [Name], [Order] FROM [Cities] ORDER BY [Order]" DeleteCommand="DELETE FROM [Cities] WHERE [ID] = @ID"> <DeleteParameters> <asp:Parameter Name="ID" Type="Int32" /> <//DeleteParameters> </asp:SqlDataSource> <telerik:RadListBox ID="RadListBox1" runat="server" AllowAutomaticUpdates="true" AllowTransfer="true" TransferToID="RadListBox2" AutoPostBackOnTransfer="true" DataKeyField="DataKeyID" DataTextField="Name" DataValueField="ID" DataSourceID="SqlDataSource1" > </telerik:RadListBox>
If you want to use the field, bound to the DataKeyField of the first RadListBox in the InsertCommands of the second ListBox, select it twice in the SelectCommand and give them different names. Then use the first one for the DataKeyField of the first RadListBox, and the second one for the InsertCommand of the second RadListBox.
Here is an example:
2. In the second RadListBox:
- Set the AllowAutomaticUpdates="True" (so the DataSource is updated automatically)
- Make sure that the DataSource has its InsertCommand set.
Here is an example:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<$ ConnectionStrings>" SelectCommand="SELECT [ID], [Name], [Order] FROM [Cities] ORDER BY [Order]" InsertCommand="INSERT INTO [Cities] ([Name], [Order]) VALUES (@Name, @Order)"> <InsertParameters> <asp:Parameter Name="Name" Type="String" /> <asp:Parameter Name="Order" Type="Int32" /> </InsertParameters> </asp:SqlDataSource> <telerik:RadListBox ID="RadListBox2" runat="server" AllowAutomaticUpdates="true" DataKeyField="ID" DataTextField="Name" DataValueField="ID" DataSourceID="SqlDataSource1" > </telerik:RadListBox>
However I am failing to see where the [InsertID] column value is actually used in the second data source. Could you clarify this? This is exactly what I need to do for the project I am working on.
Thanks