It is easy to fill a textbox using an EVAL statement when you edit a row in a RADGrid.
</Columns> <EditFormSettings UserControlName="ctlUserEdit.ascx" EditFormType="WebUserControl"> <EditColumn UniqueName="EditCommandColumn"> </EditColumn> </EditFormSettings> </MasterTableView>
<tr> <td> City </td> <td> <asp:TextBox ID="txtCity" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.City") %>'></asp:TextBox> </td> </tr>v <tr> <td> State </td>v <td> <telerik:RadCombobox ID="lstStateList" runat="server" MarkFirstMatch="true" AllowCustomText="false" DataTextField="Abbreviation" DataValueField="Abbreviation" Text='<%# DataBinder.Eval( Container, "DataItem.State") %>'> <ExpandAnimation Type="InBounce" Duration="300" /> <CollapseAnimation Type="OutQuint" Duration="200" /> </telerik:RadCombobox> </td>
The trick is to remember to set the DATASOURCE to nothing so that the DataBinding doesn't override what you set in code behind. If you don't explicitly set the DataSource property then you'll have the first item selected regardless of what the database value is.
txtCity.Text = .Item("City") & "" lstStateList.SelectedIndex = -1 Dim objItem As Telerik.Web.UI.RadComboBoxItem objItem = lstStateList.FindItemByValue(.Item("State")) lstStateList.ClearSelection() If Not IsNothing(objItem) Then objItem.Selected = True End If lstStateList.DataSource = Nothing
RadEditor - please enable JavaScript to use the rich text editor.