View Full Version : adding rows into a datagrid
Rookie
09-28-2006, 01:06 AM
I having been looking for a way to insert additional rows into a datagrid in asp.net (http://asp.net/) 2.0. I am pulling data (a list of events: date, title, etc...)from a sqldatasource and displaying it a datagrid.
I want to be able to insert a row the is formatted differently from the rest that helps visually group the events by dates.
For example
http://www.undersound2.com/images/screenshot.jpg
I see datagrid1.deleteRow(), but no datagrid1.addRow.
Anybody have any clever ideas?
Thanks
Rookie
wisemx
09-28-2006, 01:35 AM
With a bound DataGrid you can programmatically add new rows with a Select.
Templates can be applied at the same time, etc.
These two pages should help:
http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/webctrl/datagrid/doc_datagrid.aspx
http://samples.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx
joelnet
09-28-2006, 02:07 AM
I don't think you can do what you are trying to do with the datagrid, you might need to use a repeater and manually create the html rows in the table.
Joel Thoms
DiscountASP.NET
http://www.DiscountASP.NET
Rookie
09-28-2006, 03:00 AM
thanks for the quick replies. I'm gonna test out my coding skills with the repeater.
Should be interesting http://community.discountasp.net/emoticons/shocked.gif
Thanks
joelnet
09-28-2006, 10:34 AM
you'll find out it's easy to use once you do it once. good luck.
Joel Thoms
DiscountASP.NET
http://www.DiscountASP.NET
wisemx
09-28-2006, 11:06 AM
Joel, I haven't tried myself yet but I saw something similar done from a SQL Server 2005 Pivot Table indexed with templates in a ASP.NET v2.0 datalist, looked impressive and I keep meaning to create some shaped data to try it.
Problem is I'm ever forgetful. http://community.discountasp.net/emoticons/lol.gif
Rookie
09-28-2006, 11:24 AM
Could you post the link to the example you are talking about (if you still have it)?
Thanks
wisemx
09-29-2006, 10:55 AM
I will indeed.
Note:
Wehad been experimenting with this for a large Finance group who wanted to step away from Crystal Reports.
Previously they had been using an Oracle World, which can easily generate reports like the one illustrated here.
SQL Server fed Crystal Reports canbut we had to use the object model controls for Pivot Tables and it was messy.
So the idea was to use the .NET Framework and SQL Server SPs to shape the data then format it.
vBulletin® ©Jelsoft Enterprises Ltd.