Go to DotNetFunda.com
 Online : 769 |  Welcome, Guest!   Login
 
<<= Please see left side tutorials menu.

  • Nominate yourself for "Agile Software Development using Scrum" online session for FREE, click here.

  • Download OOPS and ASP.NET Online training session video and PPT from here.


Silverlight Tutorials | Report a Bug in the Tutorial

Interesting?   Share and Bookmark this

asp:DataList control
DataList control displays data using user-defined layout. However there are many added advantages in comparison with Repeater control in terms of graphical layout.
 
DataList control displays data using user-defined layout. However there are many added advantages in comparison with Repeater control in terms of graphical layout.

One of the main advantage of DataList control is it supports directional rendering (Horizontal/Vertical) also. It has many properties and several events attached. We can say DataList ias the advanced version of Repeater control.

Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <table> tag.

Following are some important properties that are very useful.
AlternatingItemTemplate Template to define the rendering of every alternate item.
FooterTemplate Template to define how to render the footer.
HeaderTemplate Template to define how to render the header.
Items Gets the collection of DataList Items.
ItemTemplate Template to define how items are rendered.
SeparatorTemplate Template to define how separator between items will be rendered.
DEMO : DataList Show Source Code
Name : adsf
Address : aefgr
Phone : efgr
City : aetfgr
|||
Name : ar
Address : a
Phone : a
City : a
|||
Name : bhavya
Address : h.no2332/10
Phone : 353534534
City : asr
|||
Name : dsafsda
Address : adsfdsf
Phone : dsfdsaf
City : dsafasdf
|||
Name : gdfgdfg
Address :
Phone :
City :
|||
Name : hello
Address : hey
Phone : xcxcv
City : xxcvb
|||
Name : N
Address : D
Phone : 545545
City : DDF
|||
Name : pam
Address : arnold
Phone : 555-1234
City : greece
|||
Name : pankaj
Address : panjiar
Phone : 8587050973
City : bentonville
|||
Name : Peter
Address : tyjufy
Phone : yguykgyu
City : gygy
|||
Name : puneet
Address : shamaasas
Phone : sdkjsdj
City : sdkjskdj
|||
Name : raj
Address : chennai
Phone : 9942350800
City : chennai
|||
Name : raj
Address : chennai
Phone : 9942350800
City : chennai
|||
Name : Raju
Address : Hyd
Phone : 747473473
City : hyd
|||
Name : rg
Address : fsdf
Phone : sdfg
City : sdg
|||
Name : rty
Address : rrr
Phone : rrr
City : rrr
|||
Name : s
Address : s
Phone : s
City : s
|||
Name : S
Address : b
Phone : 732
City : tempe
|||
Name : s
Address : s
Phone : s
City : s
|||
Name : S
Address : G
Phone : G
City : G
|||
Name : sadx
Address : asd
Phone : asd
City : asd
|||
Name : Sample
Address : 345dfgdfg
Phone : 234324235
City : cfgdfgdfg
|||
Name : sangeetha
Address : madipakkam,PP
Phone : 22343223
City : chennai
|||
Name : sarvesh
Address : usha
Phone : 1234567
City : indore
|||
Name : sd
Address : sdf
Phone : sdf
City : sd
|||
Name : sd
Address : sd
Phone : sd
City : sd
|||
Name : sda
Address : asdf
Phone : 23234
City : asdf
|||
Name : sddghdh
Address : asd
Phone : asd
City : asd
|||
Name : sdf
Address : sdfs
Phone : sfsdf
City : sdfsd
|||
Name : sdf
Address : sdf
Phone : sdf
City : sdf
|||
Name : sdf
Address : sdf
Phone : sdf
City : sdf
|||
Name : sdf
Address : sdfsf
Phone : sdfdf
City : sdfsdfsd
|||
Name : sdfa
Address : sdfa
Phone : sdfa
City : sdfa
|||
Name : sdg
Address : sdfg
Phone : sdf
City : sfg
|||
Name : sdvvvxcvxv
Address : shirdi
Phone : 3444344
City : shirdi
|||
Name : SEEMA
Address : DFCF
Phone : ERFERF
City : RGFRE
|||
Name : sm
Address : H
Phone : D
City : S
|||
Name : Sovandy
Address : Phnom Penh
Phone : 017 855 431
City : Phnom Penh
|||
Name : Sovandya
Address : 11
Phone : 017 855 431
City : PP
|||
Name : srinu
Address : sr nagar
Phone : 9703735834
City : Hyd
|||
Name : ss
Address : s
Phone : s
City : s
|||
Name : sss
Address : sss
Phone : 353656
City : hyj
|||
Name : ssss
Address : thtrh
Phone : thtrh
City : hrrthtr
|||
Name : SSSSSIIIIIIII
Address : d
Phone : h
City : h
|||
Name : Test
Address : Test
Phone : 12
City : Testbxb
|||
Name : test
Address : test
Phone : test
City : test
|||
Name : test
Address : test
Phone : test
City : test
|||
Name : test
Address : test
Phone : test
City : test
|||
Name : test
Address : test
Phone : test
City : test
|||
Name : test
Address : test
Phone : test
City : test
|||
Name : thulasi
Address : delhi
Phone : 9988765433
City : delhi
|||
Name : try
Address : 67
Phone : 567
City : 567
|||
Name : ttttt
Address : sdfasdf
Phone : 353453
City : fasdfasdfad
|||
Name : tttttttt
Address : ttttttt
Phone : gh
City : e
|||
Name : TYUTYU
Address : TYU
Phone :
City :
|||
Name : u8uuuu
Address : asdf
Phone : asdf
City : asdf
|||
Name : vidhya
Address : d
Phone : 3333
City : dddd
|||
Name : Vikas Deep
Address : DLF_3
Phone : 9650273495
City : Gurgaon
|||
Name : vivek
Address : pune
Phone : 1234556
City : oos
|||
Name : werewr
Address : sdfsd
Phone : 456456
City : 45645
No records displaying or need more records? Try inserting records from FormView Control tutorial.
 
    

// DataList Control ////////////////////////////
<asp:DataList ID="DataList1" runat="Server" DataSourceID="SqlDataSource1" DataKeyField="AutoID" Width="100%"
     RepeatColumns="2" RepeatDirection="horizontal" RepeatLayout="table" CellPadding="2" CellSpacing="1"
     BorderWidth="1">
    <ItemTemplate>
        <table width="100%" style="background-color:#efefef;">
            <tr>
                <td>
                    Name : <%# Eval("Name") %><br />
                    Address : <%# Eval("Address") %><br />
                    Phone : <%# Eval("Phone") %><br />
                    City : <%# Eval("City") %><br />                                        
                </td>
            </tr>
        </table>
    </ItemTemplate>
    <AlternatingItemTemplate>
        <table width="100%">
            <tr>
                <td>
                    Name : <%# Eval("Name") %><br />
                    Address : <%# Eval("Address") %><br />
                    Phone : <%# Eval("Phone") %><br />
                    City : <%# Eval("City")% ><br />                                        
                </td>
            </tr>
        </table>
    </AlternatingItemTemplate>
    <SeparatorTemplate>
        |||
    </SeparatorTemplate>
</asp:DataList>    



// SqlDataSource Control ////////////////////////////                
 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:ConnStr %>'
 SelectCommand="Select * FROM SampleForTutorials ORDER BY [Name]">
 </asp:SqlDataSource>
                    
                    




About Us | The Team | Advertise | Contact Us | Feedback | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found copied contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)