Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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
  #1 (permalink)  
Old December 15th, 2008, 12:07 PM
Registered User
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Add gridviewrow in databound

Hi everyone!

Is it possible to add a GridViewRow when the GrindView is Binding? To make myself as clear as possible, I'll give you an example:

I have three different groups in my DataTable, and I have to write the total of records for each group under the last name of each group! So I think the only way to do that with the GridView control, is to add a row when the GridView is Binding!!

Thank you!
  #2 (permalink)  
Old December 17th, 2008, 08:41 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From what I've read adding rows isn't possible, but I'm open to correction on this. Much easier is to add the data in your query at source so that it's returned with the rest of the results set to bind to the grid view. Look up UNION ALL, but in essence, this example would work:

Select Col1 [Amount], Col2 [Type], Col3 [OtherInfo] From MyTable
UNION ALL
Select Sum(Col1), '-', '-' From MyTable

In a UNION ALL operation, the column names are derived from the first query; these are what your gridview will bind to. The second [and any subsequent] query must contain the same number of columns and each column must be of the same type.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databound Dropdown fullingdale ASP.NET 2.0 Basics 2 June 20th, 2008 02:33 AM
Getting a databound value from datalist contrrol almotions ASP.NET 2.0 Basics 8 April 23rd, 2008 09:00 AM
extra column based on data in gridviewrow edwin.debrouwere ASP.NET 1.0 and 1.1 Basics 1 October 13th, 2006 09:18 AM
extra column based on data in gridviewrow edwin.debrouwere ASP.NET 1.0 and 1.1 Professional 0 October 13th, 2006 09:08 AM
databound headertemplate collie VB.NET 2002/2003 Basics 0 March 7th, 2005 10:31 AM





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