Scott on Writing

Musings on technical writing...

More "Working with Data in ASP.NET 2.0" Tutorials Available!

The next five tutorials in the “Working with Data in ASP.NET 2.0” series is available online. These five new tutorials make up the “Custom Formatting” section of the series, and include:

  • Custom Formatting Based Upon Data - Adjusting the format of the GridView, DetailsView, or FormView based upon the data bound to it can be accomplished in multiple ways. In this tutorial we'll look at how to accomplish data bound formatting through the use of the DataBound and RowDataBound event handlers.
  • Using TemplateFields in the GridView Control - To provide flexibility, the GridView offers the TemplateField, which renders using a template. A template can include a mix of static HTML, Web controls, and databinding syntax. In this tutorial we'll examine how to use the TemplateField to achieve a greater degree of customization with the GridView control.
  • Using TemplateFields in the DetailsView Control - The same TemplateFields capabilities available with the GridView are also available with the DetailsView control. In this tutorial we'll display one product at a time using a DetailsView containing TemplateFields.
  • Using the FormView's Templates - Unlike the DetailsView, the FormView is not composed of fields. Instead, the FormView is rendered using templates. In this tutorial we'll examine using the FormView control to present a less rigid display of data.
  • Displaying Summary Information in the GridView's Footer - Summary information is often displayed at the bottom of the report in a summary row. The GridView control can include a footer row into whose cells we can programmatically inject aggregate data. In this tutorial we'll see how to display aggregate data in this footer row.

As with the first 10 tutorials, the latest five include both C# and VB versions, can be downloaded as PDFs, and include the complete code download as a self-extracting ZIP file. Enjoy!

http://www.asp.net/Learn/DataAccess

posted on Monday, June 19, 2006 12:01 PM

Feedback

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/21/2006 6:33 AM Steve

Scott,
First of all thank you for the great learning series you are putting together @ http://www.asp.net/learn/dataaccess/
I have some minor suggestions for a follow up article.
1.) How to hide your DAL from the UI so that your UI only sees the BLL classes.

2.) How to pass a production, test, and dev connection string from your UI --> BLL --> DAL.

Just some suggestions,
Steve

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/21/2006 8:02 PM Hoang Nguyen

Hi Scott,
Can you provide us with the Style.css sheet from the 3rd tutorial that you used?

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/22/2006 6:15 AM Scott Mitchell

Hoang, the Style.css file can be downloaded with any of the tutorials. (With each tutorial, there's a link to download the associated code. For example, for the third tutorial, you can download the C# code at http://download.microsoft.com/download/4/6/3/463cf87c-4724-4cbc-b7b5-3f866f43ba50/ASPNET_Data_Tutorial_3_CS.exe and the VB code at http://download.microsoft.com/download/5/d/7/5d7571fc-d0b7-4798-ad4a-c976c02363ce/ASPNET_Data_Tutorial_3_VB.exe.)

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/22/2006 10:43 PM paketim

Thanks for the tutorials.

paketim
http://www.paketim.com

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/23/2006 11:49 PM Paging on Displaying Summary Information in the Gr

I have set allow paging to true ang page size to 5 in the Last Displaying Summary Information in the GridView's Footer tutorial.
But the paging is enabling ?
I mean i can't view the records in page rather I view all the records?
I don't Know Why?
Could You explain How Could I enable paging in this particular tutorial.

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/24/2006 4:43 AM flipdoubt

Hey Scott, great tutorials. I would like to see more on handling errors that might occur on declaritively bound controls. Since the Design View is "doing it for you", where do you put the Try/Catch? Do you have no choice but to use Server.GetLastError and Server.ClearError?

Specifically, I want to let power users enter text used to directly set my ObjectDataSource's FilterExpression, but what if there is a syntax error? How do I recover when my GridView is declaritively bound to that ObjectDataSeource?

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/24/2006 7:57 AM Scott Mitchell

flipdoubt, in the editing/inserting/deleting tutorials, there is an entire tutorial examined to handling exceptions raised from the DAL or BLL. In short, you can create an event handler in the ObjectDataSource's post-level event (like Updated, Inserted, or Deleted) and determine there, through e.Exception, whether an exception was thrown earlier in the stack or not.

If it has, you can either let it bubble up, or opt to handle it and mark the exception as being handled.

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/25/2006 6:19 AM Sachin Joshi

Hi Scott,

It's a great resource, I like the flow of the tutorial and the way it's stitched together.

Great work, thanks!

Regards,
Sachin Joshi

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/26/2006 9:15 AM Sriram

Nice Article, Thank you
I was playing with EntLib2.0 as well also and was wondering how the data access was being maintained in the typed dataset (example you have given) and are there any tradeoffs in using EntLib2.0 as far as the connections and dataccess in concerned.In simple how do we decide on using EntLib2.0(DAAB) and the Dataset method that you have used in the example.

Thanks
Sriram.

# re: Why did you decide to go with Typed Datasets ? 6/26/2006 11:48 AM Vishal

Hey Scott

I read your DAL tutorial and you did give a MS link for difference between typed Dataset vs O/R mapping. you did not mention why you chose database driven design model ( Typed datasets) vs
domain design model (Custom Business enities)

There is lot of noice on the web regarding Typed Dataset vs Custom business entities ..I know there is no right or wrong answer but I wanted to know your opinion. which one do you prefer when you go to a client site ?

Thanks
Vishal

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/27/2006 5:09 AM Andrew

Scott,
Could you explain how the DataSet stores the connection string in your project and how you can override it? It appears the connection string is hardcoded into the DataSet's designer and I'm assuming in order to override the connection string you have to create a partial class to do so? Or is thier an easier way?

Thanks,
Andrew

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/27/2006 7:19 AM Scott Mitchell

Vishal, the primary reason for doing Typed DataSets was because of the ease of creation in VS. The main thrust behind the tutorials is
highlighting working with data - master/detail, custom formatting, editing, inserting, deleting, paging, sorting, etc.

Rather than spend a half dozen tutorials on the pros and cons of the different approaches,
and showing different techniques, we just wanted a quick and simple tiered architecture (hence the reason we use ad-hoc SQL queries in the Typed DataSet vs. sprocs, to save the tutorial on explaining what sprocs were, pros/cons, etc.)

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 6/27/2006 11:56 AM Scott Mitchell

Andrew, check out this blog entry:
http://scottonwriting.net/sowblog/posts/8982.aspx

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 7/5/2006 4:53 PM Alan

Great tutorials, I'm learning loads here!

I can't seem to get typed datasets working with the new GridView in-place editing though - is this a limitation of this approach? How could I have a 3-tier architecture with in-place editing? I'm sure there must be a way, I just can't figure it out!

Thanks.

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 7/6/2006 2:07 PM Scott Mitchell

Alan, a series of tutorials on editing, deleting, and inserting data using the ObjectDataSource, GridView, FormView, and DetailsView controls will be online soon! :-)

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 7/10/2006 7:05 AM Steve

Thanks for the tutorials Scott, they're really good!

A question though, have you recently changed the tutorials? I'm sure i saw one where you had an example to display a one-to-many relationship all in a gridview but now i can't seem to find it.

What I'm trying to do is display a list of books titles, and each book may have more than one author, all in one gridview.

Thanks
Steve

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 7/10/2006 7:10 AM Scott Mitchell

Steve, I included such an example in the _first_ tutorial. Also, FYI, a tutorial on using the DataList and Repeater illustrates how to accomplish this behavior as well.

hth

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 7/10/2006 1:17 PM Steve

D'oh, thanks Scott - I thought it was on one of the later tutorials. Never thought of looking at #1!

Regarding the example, this disables the sorting and paging in the gridview, doesn;t it? Or is it just mine?

# Issues in GridView control with respect to memory release 12/3/2007 1:43 AM Santosh

what are variou issues related with the gridview control with respect to memory release when large amount of data is stored in the grid.. or an update is made?

# re: More "Working with Data in ASP.NET 2.0" Tutorials Available! 12/6/2007 2:44 PM name

a

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles