Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Blank Row When Adding to DataGrid

Reply
Thread Tools

Blank Row When Adding to DataGrid

 
 
Jason
Guest
Posts: n/a
 
      07-15-2004
I'm working on an aspx page that will display the contents of a
shopping cart then show the subtotal, any discounts, and the final
total after that. I'm pulling the contents of the shopping cart from
a database with the following code:

MyDataGrid.DataSource = cart.GetItems(cartId); // returns
// a SqlDataReader
MyDataGrid.DataBind();

After this, I would like to add three rows to the end of the DataGrid
containing the subtotal, discount, and total. To get started, I
simply want to add a single row to the end with the word "Test" in it.
I have tried the following code:

DataGridItem gridItem = new DataGridItem(0, 0, ListItemType.Header);
TableCell cell = new TableCell();
cell.ColumnSpan = 5;
cell.Text = "Test";
gridItem.Cells.Add(cell);
MyDataGrid.Controls[0].Controls.Add(gridItem);

I have tried putting this in the OnItemCreated and OnDataBinding
events and in both cases got the same result - an emtpy row appended
to the end of the DataGrid. When I view the source for the page, just
before the end of the table that is created, there is a <tr> </tr> set
of tags with nothing inside them.

If anyone can help me figure out what is going on here and how to get
this to work, I would greatly appreciate it. I apologize in advance
if this is a question that gets asked here all the time, but I've
spent all morning searching for an answer with no luck. Thank you.

--
Jason DeCock
Elk River Systems, Inc.
http://www.elkriversystems.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
plzz help me to add How a Blank row in a datagrid without using da =?Utf-8?B?YWo=?= ASP .Net 0 11-02-2004 03:20 PM
plzz help me to add How a Blank row in a datagrid without using da =?Utf-8?B?YWo=?= ASP .Net 0 11-02-2004 03:17 PM
Add a blank row to DataGrid tshad ASP .Net 4 10-20-2004 07:15 PM
Blank Row When Adding to DataGrid Jason ASP .Net Web Controls 0 07-15-2004 05:14 PM



Advertisments