How to call event ItemsRequest from custom button on footer template

5 posts, 0 answers
  1. Vaios Vaitsis
    Vaios  Vaitsis avatar
    4 posts
    Member since:
    May 2008

    Posted 22 May 2012 Link to this post

    Hi, 

    I have a following scenario:
    Generate page with dynamic controls. One of these controls is rad combo box with footer template and item template. 
    In footer template was added button. I want this button to call the event ItemsRequest.
    I will use this button to clean cache rad combo box.
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 25 May 2012 Link to this post

    Hello Vaios,

    Take a look at the following example:
    function clientClicked(sender, args) {
        var combo = $find("RadComboBox1");
        combo.requestItems("", true);
    }
    <telerik:RadComboBox runat="server" ID="RadComboBox1" OnItemsRequested="RadComboBox1_ItemsRequested"
        EnableLoadOnDemand="true">
        <FooterTemplate>
            <telerik:RadButton runat="server" Text="More" ID="RadButton1" OnClientClicked="clientClicked"
                AutoPostBack="false" />
        </FooterTemplate>
    </telerik:RadComboBox>
    protected void RadComboBox1_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        RadComboBox1.Items.Add(new RadComboBoxItem("item1"));
    }

    I hope this will help.

    Regards,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Vaios Vaitsis
    Vaios  Vaitsis avatar
    4 posts
    Member since:
    May 2008

    Posted 30 May 2012 Link to this post

    Thanks Ivana,
    your example helped me to fix it.
  4. Vaios Vaitsis
    Vaios  Vaitsis avatar
    4 posts
    Member since:
    May 2008

    Posted 30 May 2012 Link to this post

    Hi, 

    I have the same scenario, but now I want to write in the box without opening combobox list. Is this possible?
    At the moment I've set the following properties:
    private void SetProperties(FieldData fieldInfo, RadComboBox control)
    {           
       control.EnableLoadOnDemand = true;
       control.ShowMoreResultsBox = true;
       control.AllowCustomText = true;
       control.ItemsPerRequest = 50;
       control.EnableTextSelection = true;
       control.HighlightTemplatedItems = true;
       control.LoadingMessage = "Loading...";
       control.ShowDropDownOnTextboxClick = false;
       control.Filter = RadComboBoxFilter.None;              
       control.Height = Unit.Pixel(150);
       control.DropDownWidth = Unit.Pixel(420);
                
       control.Attributes.Add("relFile", fieldInfo.RelFile);
     
       control.HeaderTemplate = new HeaderTemplate();
       control.FooterTemplate = new FooterTemplate();
       control.ItemTemplate = new ItemTemplate();
    }

  5. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 01 Jun 2012 Link to this post

    Hello Vaios,

    The property ShowDropDownOnTextboxClick should do just that. If you, however, need to have some more control over the drop-down list, when it should be opened, you could subscribe to the OnClientDropDownOpening event and cancel its default action if your scenario does not satisfy certain criteria.

    All the best,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top