Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 April 4th, 2006, 03:10 PM
Authorized User
 
Join Date: Apr 2006
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Two controls with tabular data - which ones?

Hi,

I'd like to have a "table" that can get new rows, delete rows, and overall be editable. When this table is updated (via postback I guess) another table on the same page should be updated as well. Among other things, a sum for money fields in some of the rows should be updated, and the first table's money fields that belong to the same name should be added up (see below). I made a similar thing with Asp and Javascript via Innertable code, but I want to do it the .Net way if possible.

This is what I mean:

Table_1

Col1 Col2 Col3

Name1 Address1 Money1

Name2 Address2 Money2

Name2 Address3 Money3

Table_2

Col1 Col2 Col3

Name1 Somethingelse1 MoneySum

Name2+3 Somethingelse2+3 MoneySum2+3

What controls should I use? I first thought of grid views, but they don't support Delete, so I don't know what to do. I guess AJAX could be used as well, but if the postback isn't really slow, I'd like this instead.

I use Asp.Net 2.0, VB, and VWD Express (which is great, BTW!).

Thanks in advance for any help solving this (at least to me) complex task!

Pettrer


Coding is indeed a nine-to-five job; nine pm to five am.
__________________
Coding is indeed a nine-to-five job; nine pm to five am.
 
Old April 4th, 2006, 03:15 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Pettrer,

Quote:
quote:I first thought of grid views, but they don't support Delete, so I don't know what to do.
What makes you think the GridView cannot delete? If the underlying data source supports deleting (e.g. e DeleteMethod for an ObjectDataSource or a Delete query for a SqlDataSource), deleting *is* supported in GridViews.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: The Order Of Death by Public Image Ltd. (Track 8 from the album: This Is What You Want... This Is What You Get) What's This?
 
Old April 5th, 2006, 03:12 AM
Authorized User
 
Join Date: Apr 2006
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I was a bit confused there... What I should have written is that GridView does not support Add row (according to Beginning Asp.Net 2.0, p. 244).

Another thing: On the GridView's flyout menu, why don't I always get Enable Deletion and Enable Selection? (Couldn't find any info on this matter in the book.)

Thanks for replying!

Pettrer

BTW - Cool MP3-thing in your signature!

Coding is indeed a nine-to-five job; nine pm to five am.
 
Old April 5th, 2006, 01:00 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right, I see. That is correct.

In most circumstances, you can use a DetailsView to allow a user to insert new records, or edit more complex data structures (with custom templates for stuff like Calendars and so on).

Alternatively, you could create a custom class, say Content, with Get, Insert, List and Update methods. Then you can use an ObjectDataSource and use that for data access. With a custom class, it's easier to create a custom InsertUpdate page that allows you to manage your data.

You won't get these options if the underlying data source control doesn't support these features. So, when your SqlDataSource or ObjectDataSource doesn't have code to delete records, the GridView doesn't have the option on the Smart Task pane. However, you can still enable deleting for the GridView through the Properties grid for the control

I am glad you like my little unuseless Chindogu project.... ;)

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Text Fields in a Tabular Form Nadine Access VBA 2 January 17th, 2007 01:57 PM
fusion between matrix and tabular report.. johnnygut Reporting Services 0 November 16th, 2006 04:15 PM
Data Controls zztop VB Databases Basics 0 November 2nd, 2005 05:24 PM
Tabular Data Control interrupt HTML Code Clinic 0 January 25th, 2005 02:30 PM





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