radcombobox only loading data when i write

2 posts, 0 answers
  1. Carlos
    Carlos avatar
    83 posts
    Member since:
    Apr 2013

    Posted 14 Nov 2013 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Nov 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top