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

How to set Header Template Text when using Items_Requested

1 Answer 122 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 28 Feb 2014, 04:35 PM
I'm using the below markup to create a Combox that has a Header Template.  I have a potential 10000+ records so I'm using LoadOnDemand to populate the rows BUT I would like to be able to populate the HEADER labels immediately.  See the second code snippet..

The code to fire the GetTranslation is currently ignored but I've also tried the below in Init, PreRender, ItemsCreated, in all cases its either too early or in ItemsCreated, it only fires once I actually start type, which is too late.

Dim HeaderCommitmentNumber As Label = DirectCast(e.Item.FindControl("lblCommitmentNumber"), Label)
Dim HeaderVendor As Label = DirectCast(e.Item.FindControl("lblVendor"), Label)
 
HeaderCommitmentNumber.Text = MasterPage.GetTranslation("Number", False)
HeaderVendor.Text = MasterPage.GetTranslation("VendorDescription", False)


<telerik:RadComboBox ID="CommitmentNumber" runat="server" Width="100px" Height="200" DropDownWidth="450"
                               EnableLoadOnDemand="true" ItemsPerRequest="10" DataTextField="ReferenceDocumentNumber" HighlightTemplatedItems="true"
                               ExpandDelay="0" ExpandAnimation-Duration="0" CollapseAnimation-Duration="0" CollapseDelay="0" LoadingMessage='<%#MasterPage.GetTranslation("Loading", False)%>' >
                               <HeaderTemplate>
 
                                   <div style="width: 420px;">
                                       <div style="width: 75px; float: left; padding: 0 11px 0 11px; color: rgb(0, 21, 110) !important;">
                                           <asp:Label ID="lblCommitmentNumber" runat="server" Text='<%#MasterPage.GetTranslation("Number", False)%>' Font-Bold="true" />
                                       </div>
                                       <div style="width: 295px; float: left; padding: 0 11px 0 11px; color: rgb(0, 21, 110) !important;">
                                           <asp:Label ID="lblVendor" runat="server" Text='<%#MasterPage.GetTranslation("VendorDescription", False)%>' Font-Bold="true" />
                                       </div>
                                   </div>
                               </HeaderTemplate>
                               <ItemTemplate>
                                   <ul>
                                       <li>
                                           <!-- Row -->
                                           <ul>
                                               <li id="col1">
                                                   <div style="width: 75px; float: left; padding: 0 11px 0 11px; color: rgb(0, 21, 110) !important;">
                                                       <asp:Label ID="ReferenceDocumentNumber" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ReferenceDocumentNumber").ToString()%>'></asp:Label>
                                                   </div>
                                               </li>
                                               <li id="col2">
                                                   <div style="width: 295px; float: left; color: rgb(0, 21, 110) !important; margin-left: 5px;">
                                                       <div>
                                                           <asp:Label ID="lblVendor" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Vendor").ToString()%>'></asp:Label>
                                                       </div>
                                                       <div>
                                                           <asp:Label ID="lblVendorDesc" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description").ToString()%>'></asp:Label>
                                                       </div>
                                                   </div>
                                               </li>
                                           </ul>
                                       </li>
                                       <!-- End of row -->
                                   </ul>
                               </ItemTemplate>
                           </telerik:RadComboBox>

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 04 Mar 2014, 10:24 AM
Hello Tim,

Instead of trying to find the Labels from the header template in the Items of the RadComboBox (e.Item ),
you should find them in the CommitmentNumber.Header. In addition, you could use the OnLoad server-side event of the RadComboBox, in order to implement this.

Regards,
Nencho
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
ComboBox
Asked by
Tim
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or