Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2010, 08:38 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default Visited some page ahead

Hello,

Ive just visited some page ahead in the book. I went to hand-coding data access. Does this technique can apply also on showing data like the GridView ? or it is better to use a control to show data as a table ?

Thanks.
 
Old May 2nd, 2010, 05:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rushino,

For pure data display, this is pretty easy to do. Just write a LINQ query targeting your Entity Framework, assign it to the DataSource property of the GridView and call DataBind. E.g.:

Code:
 
var myAlbums = from a in db.Albums
                     select a;
GridView1.DataSource = myAlbums;
GridView1.DataBind();
When editing data, things get a little more complex. I have a detailed series about doing this here: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=476 However, this is a pretty advanced series and requires good working knowledge of C# and ASP.NET.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 2nd, 2010, 08:38 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Alright, i may get a look into this after ive read your book. This is because i care about performance and in your book you say that using these controls doesnt give you full control over the markup generated and that these controls still generate lots of markup.. so i believe that the best is by hand coding it ? however you provide way for hand coding data insertion in your book.. and this doesnt seem to be hard at all since i already know C#. The same rules may apply to data editing no ?

Waiting your feedbacks.

Thanks.
 
Old May 2nd, 2010, 08:46 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, it depends.

The DataSource controls don't generate HTML, so using an EntityDataSource or a LINQ query in Code Behind wouldn't make a difference. It's the GridView that generates output in HTML.

However, a GridView is not an easy control to recreate manually. It offers complex features such as paging, sorting, editing, deleting, selection and so on; features that are not easily reproduced with your own code.

If the output in the browser is your main concern, you probably want to use the ListView control instead.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 2nd, 2010, 05:47 PM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Alright.

So if i understand well.. to show data its better to use a control that show data such gridview or listview because of the features (autogenerated) they offer which increase productivity.. then to insert/update data i could use the hand-coding technique.. (cause i wanna use AJAX and Validation controls in them) ?

But its okay the use the controls or they really affect the performance ?

Just wanna be on the right track.

Thanks for your precious time.
 
Old May 3rd, 2010, 02:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, one way or the other, you need a way to send HTML to the browser.

A GridView or the other controls aren't necessarily bad for performance. In other words, I would not decide not to use a GridView to improve performance. However, like I said in my previous message, if you need *control over the markup*, the GridView may not always be the best option. In that case, look at the ListView.

For data entry pages I find it easier to create my own pages. Again, not related to page performance, but to "developer performance" - productivity.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Rushino (May 3rd, 2010)
 
Old May 3rd, 2010, 07:00 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Alright thanks a lots. Your help is greatly appreciated.





Similar Threads
Thread Thread Starter Forum Replies Last Post
a:visited link clearing vferratusco CSS Cascading Style Sheets 8 June 16th, 2010 11:20 AM
One step ahead jack_hilary BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 September 25th, 2009 05:38 PM
How to maintain history of last ten visited page i vishnu108mishra ASP.NET 2.0 Professional 1 February 29th, 2008 01:27 PM
Getting ahead of IDataReader? technimedia BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 13 July 31st, 2007 11:34 AM
Type Ahead Drop Down List kdkcchoco ASP.NET 1.0 and 1.1 Professional 43 February 20th, 2007 03:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.