• How to bind data to List View control in C#

    by  • June 6, 2013 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    ListView control is one of the most flexible data binding controls in ASP.NET. It provides flexibility to create your own layout and user interface to display data. Like other data binding controls in ASP.NET, ListView control also comes with templates. LayoutTemplate is new in ListView control and doesn’t exist in any other data binding controls. LayoutTemplate behaves like container for ItemTemplate or GroupTemplate. You must have to declare “itemContainer” or “itemPlaceholder” to display your data. GroupTemplate is another template that belongs to ListView control only. GroupTemplate is used for group layout.

    Write code in your ListView control like below. Define your required headers and data fields. I have defined a place holder as it is necessary to display data.

    Use following namespaces

    Now bind your ListView control after fetching data from database.




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply