Telerik List RadListView coding example

Today I needed to display a horizontal list, and allow the users to click on the items and allow me to run code in the background. 

I'm experimenting with the Telerik RadListView, and here's the result:

The dataset behind this is this:

and the code is below

 

Related Articles

... and you 'll find more on the Telerik ASPNET Menu

 

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master"
    CodeBehind="Test.aspx.vb" Inherits="Driver.Test" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server">
    <style type="text/css">
        .listview-item {
            height: 80px;
            background-color:white;
            width: 110px;
            display: inline-block;
            margin: 10px;
            border: 1px solid black;
            border-radius: 10px;
            padding: 10px;
        }
 
    </style>
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadAjaxPanel runat="server">
        <telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="PlaceHolder1"  >
            <LayoutTemplate>
                <div class="listview-layout">
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                </div>
            </LayoutTemplate>
            <ItemTemplate>
                <div class="listview-item">
                    <%# Eval("yard") %>
                    <asp:linkbutton runat="server" ID="lnkAccept" Text='<%# Eval("AcceptButtonText") %>'
                        CommandArgument='<%# Eval("yard") %>'></asp:linkbutton>
                    <asp:Label runat="server" ID="lnkAccepted" Text='<%# Eval("AcceptLabelText") %>'></asp:Label>
                </div>
            </ItemTemplate>
        </telerik:RadListView>
    </telerik:RadAjaxPanel>
 
</asp:Content>

 

Imports System.IO
Imports CrystalDecisions.Shared
Imports Telerik.Web.UI
Public Class Test
    Inherits InheritedPage
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    End Sub
 
    Private Sub RadListView1_NeedDataSource(sender As Object, e As RadListViewNeedDataSourceEventArgs) Handles RadListView1.NeedDataSource
        'code to get a dataset to populate the RadListView
        Me.RadListView1.DataSource = SPs.fp_LoadLocation_SEL(88364, App.ConnectionString).getTable
    End Sub
 
    Private Sub RadListView1_ItemCommand(sender As Object, e As RadListViewCommandEventArgs) Handles RadListView1.ItemCommand
        Try
            Dim strLocationCode As String = e.CommandArgument
 
            'update the database here
            Stop
 
        Catch ex As Exception
 
        End Try
    End Sub
End Class

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences