Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Combobox > persistent
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered persistent

Feed from this thread
  • J Do avatar

    Posted on May 27, 2011 (permalink)

    I have the following codes in master page:

    ASPX:
    <TUC:RadComboBox 
                ID="ddl" runat="server" 
                OnItemDataBound="ddl_ItemDataBound"
                OnItemsRequested="ddl_ItemsRequested"
                DataTextField="Descr"
                DataValueField="Code"
                PostBackUrl="~/Main.aspx"
                ForeColor="Red"
                Font-Bold="true"
                AutoPostBack="true"
                />

    CS:
    protected void Page_Load(object sender, EventArgs e)
    {
                if (!IsPostBack)
                    GetUsers();
    }
      
    protected void GetUsers()
            {
                ddl.DataSource = getddl();
                ddl.DataBind();
                if (CurrentSelectedItem != 0)
                   ddl.SelectedValue = CurrentSelectedItem .ToString();
            }
      
            protected void ddl_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
            {
                RadComboBoxItem item = e.Item;
                DataRowView row = (DataRowView)e.Item.DataItem;
                if (Convert.ToBoolean(row["IsDefault"]) && CurrentSelectedItem == 0)
                {
                    item.Selected = true;
                    CurrentSelectedItem = Convert.ToInt32(e.Item.Value);
                }
            }
            protected void ddl_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
            {
                CurrentSelectedItem = Convert.ToInt32(e.Value);
            }


    When I tried to select an item but will not fire ItemsRequested and when it return back to Main.aspx,  the value is changed back to originial selected.   Please help

    Is there any way that I can achieve this more easier?

    Thanks,Tom

  • Dimitar Terziev Dimitar Terziev admin's avatar

    Posted on Jun 2, 2011 (permalink)

    Hi Tom,

    Could you clarify what exactly are your requirements, since I'm not quite sure what do you want to achieve.

    In general ItemsRequested event is used to load items on demand, but since you are binding your combobox on initial page load I'm not quite sure why do you need this event handling function.

    The problem in your current configuration is the fact that the ItemsRequested event is not fired since you don't have the EnableLoadOnDemand="true" property set. Please check this help article regarding the ItemsRequested event.

    Kind regards,
    Dimitar Terziev
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Combobox > persistent