Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Reply With Quote
  #2 (permalink)  
Old May 2nd, 2010, 05:32 AM
Imar's Avatar
Wrox Author
Points: 72,019, Level: 100
Points: 72,019, Level: 100 Points: 72,019, Level: 100 Points: 72,019, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,075
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
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.
Reply With Quote
  #4 (permalink)  
Old May 2nd, 2010, 08:46 AM
Imar's Avatar
Wrox Author
Points: 72,019, Level: 100
Points: 72,019, Level: 100 Points: 72,019, Level: 100 Points: 72,019, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,075
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #5 (permalink)  
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.
Reply With Quote
  #6 (permalink)  
Old May 3rd, 2010, 02:06 AM
Imar's Avatar
Wrox Author
Points: 72,019, Level: 100
Points: 72,019, Level: 100 Points: 72,019, Level: 100 Points: 72,019, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,075
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Rushino (May 3rd, 2010)
  #7 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.