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

[Solved] ComboBox w Template blank

2 Answers 121 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 09 Jul 2009, 11:05 PM
Hi:
The following displays nothing... Q2 2008 library
Phil
<%@ Page Language="C#" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<script runat="server"
</script> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadComboBox ID="cboReport" runat="server" Width="300px"  
            AutoPostBack="True" HighlightTemplatedItems="True"  
            CausesValidation="False" > 
            <ItemTemplate> 
                <asp:Label runat="server" style="font-weight: bold"><%# DataBinder.Eval(Container, "Attributes['DisplayText']") %></asp:Label><br /> 
                <asp:Label ID="Label1" runat="server" style="font-size: smaller;"><%# DataBinder.Eval(Container, "Attributes['About']") %></asp:Label><br /> 
            </ItemTemplate> 
            <Items> 
                <telerik:RadComboBoxItem runat="server" Value="0" Text="Item 0" DisplayText="Item 0" About="This is Item 0" /> 
                <telerik:RadComboBoxItem runat="server" Value="1" Text="Item 1" DisplayText="Item 1" About="This is Item 1" /> 
                <telerik:RadComboBoxItem runat="server" Value="2" Text="Item 2" DisplayText="Item 2" About="This is Item 2" /> 
                <telerik:RadComboBoxItem runat="server" Value="3" Text="Item 3" DisplayText="Item 3" About="This is Item 3" /> 
            </Items> 
        </telerik:RadComboBox> 
    </div> 
    </form> 
</body> 
</html> 
 

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 10 Jul 2009, 01:15 PM
Hello Phil,

DataBinding expressions (<%# %>) are evaluated only when the control is databound. You need to call the DataBind method of RadComboBox and the templates will be filled with the corresponding values.

Best wishes,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Phil
Top achievements
Rank 2
answered on 11 Jul 2009, 04:04 AM
Thanks, this does the job.
protected void Page_Load(object sender, EventArgs e) 
    radcomboboxDisplay.DataBind(); 
 
Tags
ComboBox
Asked by
Phil
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Phil
Top achievements
Rank 2
Share this question
or