Rad Combo Rebind

9 posts, 0 answers
  1. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 19 Jun 2012 Link to this post

    Hi all,


    How can i rebind my Rad Combo 


    Regard's

    Prassin
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Jun 2012 Link to this post

    Hi Prassin,

    For Rebinding the RadComboBox try the DataBind() method of the RadComboBox as follows.

    C#:
    RadComboBox1.DataBind();

    Hope this helps.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 19 Jun 2012 Link to this post

    Hi shinu,

    i have already did this functionality .. its not working that seems

    Regards

    Prassin
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Jun 2012 Link to this post

    Hi,

    Please elaborate your scenario with code so that I can replicate the issue.

    Thanks,
    Shinu
  6. Prassin
    Prassin avatar
    87 posts
    Member since:
    Jun 2012

    Posted 20 Jun 2012 Link to this post

    Hi Shinu,


    i have one combo box. the visibility of this combo box depends up on a button click. if the state of the combo box is not visible that time i need to rebind the combo filed.. other wise the previous selected item is shown at when the combo state visible . so i need to avoid this problem.


    thanks 
  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Jun 2012 Link to this post

    Hi Prassin,

    Here is the code snippet that I tried and worked as expected at my end.

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" ></telerik:RadComboBox>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" />

    C#:
    protected void Page_Load(object sender, EventArgs e)
        {
            con = new SqlConnection(str);
            command = "SELECT EmployeeID, FirstName FROM Employees";
            ad = new SqlDataAdapter(command, con);
            DataTable dt = new DataTable();
            ad.Fill(dt);
            RadComboBox1.DataTextField = "FirstName";
            RadComboBox1.DataValueField = "FirstName";
            RadComboBox1.DataSource = dt;
            RadComboBox1.DataBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (RadComboBox1.Visible == false)
            {
                con = new SqlConnection(str);
                command = "SELECT EmployeeID, FirstName FROM Employees";
                ad = new SqlDataAdapter(command, con);
                DataTable dt = new DataTable();
                ad.Fill(dt);
                RadComboBox1.DataTextField = "FirstName";
                RadComboBox1.DataValueField = "FirstName";
                RadComboBox1.DataSource = dt;
                RadComboBox1.DataBind();
                RadComboBox1.Visible = true;
            }
            else
            {
                RadComboBox1.Visible = false;
            }
        }

    Please provide your code if it doesn't helps.

    Thanks,
    Shinu.
  8. Daniel
    Daniel avatar
    4 posts
    Member since:
    May 2009

    Posted 20 Mar 2014 Link to this post

    how can I rebind when model binding (Selectmethod) is used? 

    thx
  9. Daniel
    Daniel avatar
    4 posts
    Member since:
    May 2009

    Posted 20 Mar 2014 Link to this post

    second question

    How can i set the selected item in RadComboBox when SelectMethod is fired after Page_PreRender?

    thx
  10. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Mar 2014 in reply to Daniel Link to this post

    Hi Daniel,

    As for your first question you can use the following code snippet to Rebind the RadComboBox.

    C#:
    RadComboBox1.DataSourceID = "ObjectDataSource1";
    RadComboBox1.DataTextField = "OrderID";
    RadComboBox1.DataValueField = "OrderID";
    RadComboBox1.DataBind();

    Please try the following code snippet to select an item of the RadComboBox.

    RadComboBox1.FindItemByText("10310").Selected = true;

    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017