RadComboBox for ASP.NET

Templates with ExternalCallBackPage Send comments on this topic.
TroubleShooting > Templates with ExternalCallBackPage

Glossary Item Box

When using an ExternalCallBackPage, the ItemTemplate used by the combobox should be declared in both the parent and the external pages.

It would be best if the ItemTemplates' definitions are the same within both the pages.

Here is how the ItemTemplate will be applied in an "external streamer" mode.

  • The ItemTemplate defined in the parent page will be applied to the items that are added upon the page_load (or inline), without a callback.
  • The ItemTemplate defined in the external streamer page will be applied to the items loaded via callback.

 

If the ItemTemplates defined in the parent and streamer pages are different, the templates applied to static and on-demand items will be different. Sometimes this might be the needed behavior.

Example

Parent's ASPX Copy Code
<rad:RadComboBox
   
ID="RadComboBox1"
   
runat="server"
   
AllowCustomText="True"
   
EnableLoadOnDemand="True"
   
ExternalCallBackPage="ExternalCallBackPage1.aspx" SkinsPath="~/RadControls/ComboBox/Skins" Width="150px">            
   
<ItemTemplate>
       
<%# DataBinder.Eval(Container, "Text") %>
   
</ItemTemplate>            
</rad:RadComboBox>

 

Parent's codebehind Copy Code
protected void Page_Load(object sender, EventArgs e)
{
   
if (!Page.IsPostBack)
   {
       RadComboBox1.Items.Add(
new RadComboBoxItem("item1", "1"));
       RadComboBox1.Items.Add(
new RadComboBoxItem("item2", "2"));
       RadComboBox1.Items.Add(
new RadComboBoxItem("item3", "3"));
   }
}

 

Streamer's ASPX Copy Code
<rad:RadComboBox
   
ID="RadComboBox1"
   
runat="server"
   
AllowCustomText="true"
   
EnableLoadOnDemand="true"
   
OnItemsRequested="RadComboBox1_ItemsRequested">
   
<ItemTemplate>
       
<input type="text" id="textBox" value='<%# DataBinder.Eval(Container.DataItem, "Text") %>' />
       
<%# DataBinder.Eval(Container.DataItem, "Text") %>
   
</ItemTemplate>
</
rad:RadComboBox>

 

Streamer's codebehind Copy Code
protected void RadComboBox1_ItemsRequested(object o, Telerik.WebControls.RadComboBoxItemsRequestedEventArgs e)
{
   DataTable table =
new DataTable();
   table.Columns.Add(
"Text");
   table.Rows.Add(
new string[] { "Item 1" });
   table.Rows.Add(
new string[] { "Item 2" });
   
this.RadComboBox1.DataSource = table;
   
this.RadComboBox1.DataBind();
}

The result will be:

  • Upon initial page_load


  • After Load On Demand