.NET 4.0 thinking about the client side

by Arra Derderian 6. November 2010 23:25

I have always utilized the repeater control when I need a flexible lightweight data binding control. Based on some of the new functionality in .NET 4.0 I may be switching to the ListView control.

In .NET 4.0 the ListView control has a property called ClientIDRowSuffix where you can specify it to automatically generate unique ID's for elements that are dynamically created by the ListView. This is great because using AJAX to update rows or load new rows you need a unique identifier for each element and you would always have to build this logic in on your own. Microsoft also built in the ability to have .NET generate client ID's that are closer to what you actually specify than the automatically generated ID's of previous versions. You should specify ClientIDRowSuffix="ID" and ClientIDMode="Predictable" to get this to work. You will then be given ID's on your elements that are uniquely based on the ID property of your datasource and the ListView ID + Control ID.

These new features are great for client side manipulation and allow you to target elements easily by ID using a library like jQuery. Having to target elements by class is slower and also mixes logic with presentation. 

Also, the ListView control allows a lot more templates to be defined for scenarios such as EmptyItems, SelectedItems, and InsertingItems. Support for grouping, sorting, and pagination is very good as well. I especially like that instead of declaring header, item, and footer templates you declare a layout template that specifies how to render the surrounding markup of the items. This lets you not have broken table or list structures in your code that produce warnings.

I think it might be time to give up the old repeater and move on.

 

 

 

Tags: , ,

ASP.NET | jquery | Technology

Comments

9/29/2011 1:17:51 PM #

filter elements

Oh, so unexpected, so surprise! Very touching, so well written and I have

some perception, learning very much. Thank you for sharing. Very happy

to see these and believe that your point of view.

filter elements United States | Reply

11/7/2011 10:22:14 AM #

visite Marrakech

I always was attentive in this issue also tranquil am, value it for putting up.

visite Marrakech France | Reply

11/13/2011 9:41:26 AM #

Tout Marrakech

I like what you males are up similarly. Such handy process furthermore reporting! Preserve up the magnificent processs males I’ve incorporated you males to my blogroll. I opine it choose emend the rate of my point Sourire . “A quadrangle is a region where what was lost prior suits again undetermined than always.” by Henry Waldorf Francis.

Tout Marrakech France | Reply

11/16/2011 1:29:40 AM #

pret immobilier maroc

Woh I like your capacity , saved to favorites ! .

pret immobilier maroc France | Reply

11/17/2011 1:25:50 PM #

BMW GT1

haplessly inept Latino gangstas next door (this was at the height of Cube's rather public spat with Cypress Hill, context fans

BMW GT1 Nicaragua | Reply

12/14/2011 9:52:09 AM #

New Era snapback


SO Luky can reay this  article and  inspire by your iders<a href="http://www.nflsnapbacksale.org/">Snapbacks Hats</a> , The topic is a fresh take on a few things. the works <a href="www.nflsnapbacksale.org/nfl-snapback-hats-c-272.html">Snapback Nfl  Hats</a>to the layout of a balanced,innovative themes, delicate lace, special the article of this core  value  told us we should read and prove anything we want, for we<a href="http://www.nflsnapbacksale.org/">New Era snapback</a> are sufficientto judge aright  

New Era snapback People's Republic of China | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

Click to change captcha
biuquote
  • Comment
  • Preview
Loading