How to set Header Template Text when using Items_Requested

2 posts, 0 answers
  1. Tim
    Tim avatar
    40 posts
    Member since:
    Sep 2012

    Posted 28 Feb 2014 Link to this post

    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)%>' >
                                       <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 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" />
                                               <!-- Row -->
                                                   <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>
                                                   <li id="col2">
                                                       <div style="width: 295px; float: left; color: rgb(0, 21, 110) !important; margin-left: 5px;">
                                                               <asp:Label ID="lblVendor" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Vendor").ToString()%>'></asp:Label>
                                                               <asp:Label ID="lblVendorDesc" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description").ToString()%>'></asp:Label>
                                           <!-- End of row -->
  2. Nencho
    Nencho avatar
    1446 posts

    Posted 04 Mar 2014 Link to this post

    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.

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top