Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

ListBox / Header and Footer Templates

 
  • Birthday present for Emily

  • This example shows how to use header and footer templates with RadListBox. You can add header/footer template both declaratively and from the code behind, in pretty much the same way as all other types of templates.

    You can add html entities as well as server-side controls to the header/footer templates.

    Once server-side control is added to the header/footer template it can be accessed using the FindControl method provided by the Header/Footer properties of RadListBox.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="VB" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb" Inherits="ListBox_Examples_ApplicationScenarios_InsertItem_DefaultVB" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <qsf:HeadTag ID="Headtag1" runat="server" />
        <style type="text/css">
            .innerArea
            {
                width: 748px;
                margin: 20px auto 0 auto;
            }
            .RadListBox div.rlbHeader
            {
                overflow:hidden;
                background-image: url('Images/head_back.jpg');
                height:25px;
            }
            .example-panel
            {
                width: 748px;
                height: 483px;
                background: transparent url(Images/back.jpg) no-repeat 0 0;
                position: relative;
            }
            .addButton, .addButton img
            {
                vertical-align:middle;
            }
            .addButton
            {
                float: right;
                display: block;
            }
            #TitleTextBox
            {
                width: 140px;
            }
            #RadListBox1
            {
                left: 284px;
                position: absolute;
                top: 109px;
            }
        </style>
    </head>
    <body class="BODY">
        <form id="Form1" runat="server">
        <asp:ScriptManager runat="server" ID="RadScriptManager1" />

        <qsf:Header ID="Header2" runat="server" NavigationLanguage="VB" />
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" CssClass="example-panel">

            <telerik:RadListBox runat="server" ID="RadListBox1" Width="179px" Height="236px" >
                <ButtonSettings Position="Bottom" />
                <HeaderTemplate>
                    &nbsp;
                </HeaderTemplate>
                <Items>
                    <telerik:RadListBoxItem Text="Birthday present for Emily" />
                </Items>
                <FooterTemplate>
    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" Display="None"
    ControlToValidate="TitleTextBox" ErrorMessage="Title is required" />

                    <asp:LinkButton runat="server" ID="AddButton" CssClass="addButton" OnClick="AddButton_Click">
                    <img src="Images/add_button.gif" alt="Add" />
                    </asp:LinkButton>
                    <telerik:RadTextBox runat="Server" ID="TitleTextBox" EmptyMessage="Task Title" />
                </FooterTemplate>
            </telerik:RadListBox>

        </telerik:RadAjaxPanel>
        <qsf:Footer ID="Footer2" runat="server" />
        <asp:ValidationSummary runat="server" ShowMessageBox="true" ID="ValidationSummary1" />
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451