Load on Demand and Edit

2 posts, 0 answers
  1. archimede
    archimede avatar
    103 posts
    Member since:
    Jul 2006

    Posted 11 Nov 2010 Link to this post

    I want to use LoadOnDemand for a combobox. The comboBox is:

    <telerik:RadComboBox ID="rcbProva" runat="server" EmptyMessage="Seleziona..." EnableLoadOnDemand="true" OnItemsRequested="rcbProva_ItemsRequested">

    I want to bind the radComboBox with a selectedValue but it seems not to work .
    How can I set the SelectedValue of a RadComboBox using EnableLoadOnDemand=true? Anyone has an example?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Nov 2010 Link to this post

    Hello Archimede,

    Since you set the EnableLoadOnDemand to true, the combo will populate only when the user types the text or clicks on the drop-down toggle image. If you want to bind the RadComboBox with a SelectedValue you can try to add the item on page load.

    protected void Page_Load(object sender, EventArgs e)
           if (!IsPostBack)
               string value = "3";
               SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
               SqlCommand cmd = new SqlCommand("select EmployeeID,FirstName from Employees where EmployeeID='" + value + "'", con);
               SqlDataAdapter da = new SqlDataAdapter(cmd);
               DataTable dt = new DataTable();
               RadComboBoxItem item = new RadComboBoxItem(dt.Rows[0]["FirstName"].ToString());
               rcbProva.Items[0].Selected = true;

    You can find another approach in the following forum post.

Back to Top