Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 23, 2011 02:11 PM by digbydog
Nov 23, 2011 02:01 PM|LINK
Maybe because I'm new to ASP.Net I find working on .aspx pages very complex and am tempted to move as much code as possible into the C# files. For example I have a small application with a
GridView and DataSource controls all generated by using the wizards on the design pages in Visual Studio 2010.
Would it be considered good practice to move this into the C# code or should I just learn to live with it.
Nov 23, 2011 02:08 PM|LINK
ultimately i dont ever use DataSource controls for my gridviews or any datacontrols. i tend to keep these all in the code behind files, for the aspx pages, or in .cs files. a good practice, since you're starting off, is to get into Entity Framework. it's
very simple to use and to set up. here's a link for getting started:
this is the "code first" method. the following link is the opposite (making your DB first).
this guy has a lot of tutorials for EF (i believe 6 in all), and are extremely detailed and helpful.
instead of using datasource controls, you can manipulate which data you want to show, hide, update, insert and delete easily, then bind your datasource in codebehind to your data controls.
a good language to go along w/ Entity framework and your data controls is Linq. if you aren't familiar with Linq, i highly advise that you get comfortable w/ it, as it's extremely powerful. good luck to you.
By: Joseph C. Rattz Jr.
Pub. Date: November 2007
Print ISBN: 978-1-59059-789-7
Web ISBN: 1-59059-789-3
Nov 23, 2011 02:11 PM|LINK
Thanks for that quick and detailed response.