Sunday, September 9, 2012

Datalist Control

In my previous post I wrote about repeater control.

We have a similar control to repeater i.e. a Datalist.

There is a difference in repeater control and a datalist control if you see coding wise. Datalist gives you an option of repeat direction i.e. if you want to repeat the items horizontally or vertically. Also, it gives you an option of into how many columns do you want your data to be listed.

There is one more difference between repeater and datalist which can be seen only in the view source of the page. Repeater generates only a span tag and datalist generates a table tag as you can see below. The above table tags are generated by datalist and the below span tags are generated by repeater control.



Business logic is similar to that of repeater.

Lets see it. Below is the design source code for datalist. There you can see that I have given repeat direction and repeat columns.


And lets see the business logic of  it below.


You can decide for yourself when to use repeater and when to use datalist.

Happy Coding!!!

  

No comments:

Post a Comment