This is a migrated thread and some comments may be shown as answers.

How to call event ItemsRequest from custom button on footer template

4 Answers 105 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vaios Vaitsis
Top achievements
Rank 1
Vaios Vaitsis asked on 22 May 2012, 11:44 AM
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.

4 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 25 May 2012, 09:34 AM
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.
0
Vaios Vaitsis
Top achievements
Rank 1
answered on 30 May 2012, 12:12 PM
Thanks Ivana,
your example helped me to fix it.
0
Vaios Vaitsis
Top achievements
Rank 1
answered on 30 May 2012, 12:26 PM
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();
}

0
Ivana
Telerik team
answered on 01 Jun 2012, 11:56 AM
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.
Tags
ComboBox
Asked by
Vaios Vaitsis
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Vaios Vaitsis
Top achievements
Rank 1
Share this question
or