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

radcombobox only loading data when i write

1 Answer 21 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 14 Nov 2013, 12:27 PM
HI all i havea radcombo box, inside a templateform,  that only loads, data when i write something.
the problem is what to do load on pressing the dropdownbutton.
Or Loading data automatic, and selecting the value that previous was on the grid.

I see many places to use selectedvalue but for some reason it doenst apear on my options.

Help

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 18 Nov 2013, 05:56 AM
Hi Carlos,

I guess you are using a RadComboBox in the EditItemTemplate of a RadGrid. Please try the following code snippet.

ASPX:
<telerik:GridTemplateColumn
    <EditItemTemplate>
        <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="Country" DataValueField="Country">
        </telerik:RadComboBox>
    </EditItemTemplate>
</telerik:GridTemplateColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem data = (GridEditableItem)e.Item;   
        RadComboBox combo = (RadComboBox)data.FindControl("RadComboBox1");//Access Template column in edit mode 
        combo.SelectedValue = DataBinder.Eval(data.DataItem, "Country").ToString(); // to set the value
    }
}

Thanks,
Princy
Tags
ComboBox
Asked by
Carlos
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or