Dynamic GridView and DataList in ASP.NET 2.0
page 3 of 10
by Satheesh Babu
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38848/ 625

Steps for creating Template class

1.    Create a Template class (MyTemplate class, Listing 2 –TemplateClass for DataList) that implements ITemplate interface.

2.    Create a constructor for the class that takes ListItemType as argument so that we can determine whether we are constructing HeaderTemplate, ItemTemplate or FooterTemplate. Also, we can make it through by exposing ListItemType as public property.

3.    Implement the InstantiateIn (Control container) method and construct the corresponding template from the input gotten from the constructor. Refer to the code (Listing 2 –TemplateClass for DataList and Listing 5 –TemplateClass for GridView) for a clear understanding.

4.    For data binding and child control that require data binding, create a data binding event to fill the data with the control. This event will be raised after the template items are created with all its controls.

5.    The above 4 steps have been implemented in the code, Listing 2 –TemplateClass for DataList and

6.    Listing 5 –TemplateClass for GridView.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 6 and 1 and type the answer here:

User Comments

Title: yes   
Name: no
Date: 1/8/2009 4:43:25 AM
Comment:
no
Title: JSON LINQ   
Name: willian brasil
Date: 10/3/2008 1:18:03 PM
Comment:
Very Good!
Title: Data List   
Name: Deleep Kumar Pavana
Date: 9/11/2008 5:03:07 AM
Comment:
Hi satheesh,
Its good but repeat colomns property is not working properly on that,if i use table tag to display data in table format..
Title: Good Work ....   
Name: Mudassar C
Date: 7/17/2008 1:09:10 AM
Comment:
Hi Sateesh,
Its a really good article to read..
Good piece of Code..

Mudassar Chandle
Title: Data List And GridView   
Name: Santosh Kumar
Date: 6/24/2008 3:36:54 AM
Comment:
Hi Satheesh,
I read this article , good work done.
Santosh Kumar
http://www.operativesystems.com
Title: VB Please   
Name: Matt
Date: 6/3/2008 1:11:24 AM
Comment:
Any chance I can get this in VB?
Please
THanks
Matt
Title: problem with binding   
Name: Kannan
Date: 5/15/2008 2:51:40 AM
Comment:
All item template values displayed at once.no reapeated datalist display
Title: muhajiran bugok   
Name: muhajiran bugok
Date: 5/9/2008 6:43:36 AM
Comment:
this is very helpful..
-putang ina nyo lahat
Title: sivaram   
Name: sivaram
Date: 2/4/2008 1:47:59 AM
Comment:
Thanks.

hi i read your article.it is well and good article.

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 1/8/2009 12:13:56 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search