Last post Jul 17, 2008 07:53 AM by hooplafoo
Feb 06, 2007 03:17 PM|nav_nav2000|LINK
In development there is always a question which control to choose. I think many developers including myself are not clear on which control should be should for which purposes.
Can you pls explain what are the pros and cons of these controls and also why some say that Gridview is a heavy control and repeater is a light control what does that mean. what makes a control heavy and what makes a control light......does it really matter
in professional applications which control you use?
kindly throw some light. thanks.
Feb 06, 2007 04:32 PM|luvdairish|LINK
Still kind of new myself, but this is what my book says:
Control - Capabilities
GridView - Read/Edit
DataList - Read/Edit
Repeater - Read Only
DetailsView - Read/Edit/Create
FormView - Read/Edit/Create
I pick a control based on what I want to do, then practice with it. Before I got this book, I didn't know which control to use for certain things.
Not sure about the heavy/light thing. Maybe because the GridView is a more detailed? I don't know.
Feb 06, 2007 04:39 PM|AjPtl|LINK
Feb 06, 2007 07:24 PM|nav_nav2000|LINK
Thanks a lot for your deailed reply. i still not clear about one thing. what makes a control heavy and light from the software point of view.
lets say that i can use a repeater or a datalist for doing something but instead of these i choose to use gridview then what diff does it make.......gridview can still do what a repeater can do........so why should i use repeater........what makes repeater
lighter then gridview? does it take more time to load gridview then repeater.?
Feb 06, 2007 07:45 PM|luvdairish|LINK
Ok. I did a little search on the internet and found this site http://www.webreference.com/programming/asp/viewstate/. When you get to the page, scroll down about 1/2 way and you'll see some examples of Light/Heavy controls. I don't know where you heard
this information, but I couldn't find much out there on the subject.
What I got out of it
It seems as though "Heavy" and "Light" refer to how much ViewState is created for the control. It looks like the more data, the more heavier it gets. So I don't think it matters so much which of these controls you use. They are probably all considered
Feb 23, 2007 04:31 PM|Holf|LINK
You'll generally find that the more features a control has, the more 'heavy' it will be. As well as increasing ViewState size, heavier controls also have a greater hit on CPU load and memory requirements.
Does this matter? It really depends on what sort of load you expect your site to have. If you're coding a simple site on a dedicated box and you only have ten users or so it doesn't really matter what you use. But if you're writing something for many thousands
of users and you want to squeeze all you can out of limited hardware, then the use of a GridView when you could better use a less heavy DataGrid can make all the difference.
Bear in mind that ViewState size can also be a problem in itself. ViewState can add tens of kilobytes to a page size, which doesn't seem too bad unitl you consider the impact this has with thousands of users. The monthly bandwidth that your hosting provider
allows you is suddenly getting eaten up much more quickly.
Personally I always try to use the simplest control necessary to do the job, because usually that will be the most efficient way to do it.
Feb 23, 2007 04:43 PM|Holf|LINK
I should add something here on performance in general:
Although choosing the appropriate control will make a difference to performance, this difference is not usually huge. Such performance considerations only make sense if you are treating performance seriously from all angles. For example, establishing a data-caching
strategy, making sure you are only retreiving relevant data result-sets when paging, deciding on how best to pass data around between layers etc... these are all probably more important. It is only when you apply all these techniques that the sum total of
the parts starts to make a real difference, performance-wise.
Feb 23, 2007 05:55 PM|kblackwell|LINK
I started a thread yesterday along similar lines:
I'm a bit confused on what control to use. I want to be able to edit, and I want to be able to the editable data elements into a table.
Right now I've got my stuff in a DetailsView, but found I can't put those data controls into a table. [:(]
Feb 23, 2007 06:37 PM|luvdairish|LINK
Based on what I've read in your other post (edit capability and table structure), and of course my newbie knowledge of this ASP stuff, I would suggest a FormView if you truly want complete control over everything. I haven't used it much (again, I'm new),
but I think you can do exactly what you want.
Here is a super-good tutorial on ASP 2.0. http://msconline.maconstate.edu/tutorials/default.aspx
FormView Editing Example - http://msconline.maconstate.edu/tutorials/ASPNET20/ASPNET09/aspnet09-03.aspx
Another FormView Editing Example -
In those links, under the heading "Coding the FormView" it shows a FormView with a table structure nested inside of templates. I hope this helps. If you need anything else, write back. [:D]
Feb 23, 2007 06:54 PM|kblackwell|LINK
I'll investigate those links shortly!
Feb 25, 2007 05:15 PM|wildert|LINK
Mar 06, 2008 06:25 PM|ccatto|LINK
Thank you everyone this was a very helpful post.
Jul 17, 2008 07:53 AM|hooplafoo|LINK
How do you cast a listitem into a typed object that was bound to collection of those typed objects? I was only able to get to work with a datalist... If anyone can point out how to do that with alist view that would be helpful...
how to do this with the items noted above?