
6 Answers, 1 is accepted

Try binding the SelectedValue of the combobox in the edit form.
<rad:GridTemplateColumn HeaderText="Country" UniqueName="CountryColumn">
<EditItemTemplate>
<asp:DropDownList id="ddList1" Height="200px" runat="server"
DataTextField="Country"
DataValueField="Country"
DataSource='<%# LoadCountryNames() %>'
SelectedValue='<%# Bind("Country")%>' />
</EditItemTemplate>
........................
Thanks,
Princy

FYI, I am using ASP.NET 2.0 and I just couldn't find SelectedValue property neither in rad:combobox nor in asp:dropdownlist.
Thanks.
Milan G

The SelectedValue property of the RadComboBox will not be recognized by Intellisense. Try typing it on the aspx side. It will work as expected.
Shinu.

Any pointer?
Thanks again.
Milan G

Here is a snippet of the code..
<telerik:GridTemplateColumn HeaderText="Client" UniqueName="Client">
<ItemTemplate>
<asp:Label ID="lblClient" runat="server" Text='<%#Eval("Budget_Client")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID="lstClient" runat="server" DataSourceID="SrcForClient" DataTextField="ClientName" DataValueField="ClientID" SelectedValue='<%#Eval("Budget_Client")%>'>
</telerik:RadComboBox>
<asp:Label ID="lblOriginalClient" runat="server" Text='<%#Eval("Budget_Client")%>'></asp:Label>
</EditItemTemplate>
</telerik:GridTemplateColumn>
Somewhere down ..
<asp:ObjectDataSource ID="SrcForClient" runat="server" SelectMethod="GetAllClient" TypeName="ProjectX.ClientManager"></asp:ObjectDataSource>
Could you please let me know what is wrong?
Thanks a lot
Milan G

Sorry..I made the mistake by in assigning selectedValue. This is done now. Further down, why is the new selection made in the combo box not reflected when clicking update button?
Code Snippet..
<telerik:GridTemplateColumn HeaderText="Client" UniqueName="Client">
<ItemTemplate>
<asp:Label ID="lblClient" runat="server" Text='<%#Eval("Budget_Client")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID="lstClient" runat="server" DataSourceID="SrcForClient" DataTextField="ClientName" DataValueField="ClientID" SelectedValue='<%#Eval("Budget_Client")%>'>
</telerik:RadComboBox>
<asp:Label ID="lblOriginalClient" runat="server" Text='<%#Eval("Budget_Client")%>'></asp:Label>
</EditItemTemplate>
</telerik:GridTemplateColumn>
Somewhere down ..
<asp:ObjectDataSource ID="SrcForClient" runat="server" SelectMethod="GetAllClient" TypeName="ProjectXX.ClientManager"></asp:ObjectDataSource>
Corresponding codebehind file..
Protected
Sub gridException_UpdateCommand(ByVal source As System.Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gridException.UpdateCommand
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim exceptionTable As DataTable = Me.GridSource
Dim id As String
id =
CType(editedItem("BudgetExceptionID").Controls(0), TextBox).Text
lblErrorMsg.Text = id.ToString() +
"testing"
'Locate the changed row in the DataSource
Dim changedRows() As DataRow = exceptionTable.Select("BudgetExceptionID = " & id)
If (changedRows.Length <> 1) Then
lblErrorMsg.Text =
"Unable to locate the Order for updating."
e.Canceled =
True
Return
End If
'Update new values
Dim newValues As Hashtable = New Hashtable
'The GridTableView will fill the values from all editable columns in the hash
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
changedRows(0).BeginEdit()
Try
For Each entry As DictionaryEntry In newValues
changedRows(0)(
CType(entry.Key, String)) = entry.Value
Next
changedRows(0).EndEdit()
Catch ex As Exception
changedRows(0).CancelEdit()
lblErrorMsg.Text =
"Unable to update Orders. Reason: " & ex.Message
e.Canceled =
True
End Try
End Sub