Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 March 4th, 2004, 12:08 PM
Authorized User
 
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inser a blank row in a data table.

Hi..

any body can help me out how to insert a blank row after a selected data.

example:
if i have a product Named : dvd player . of the different company then I have other product Named : VCR then how can I put a blank line between two products in a table which I am generating with the data base.
any kind of the help welcome..
thanks


Aashish Shah
__________________
Aashish Shah
 
Old March 4th, 2004, 12:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Assuming that you are using a For..Next Loop, add this after your code that adds a row from the database:

tblRow = New TableRow
tblCell = New TableCell

tblCell.Text = ""
tblRow.Cells.Add(tblCell)

tblTable.Rows.Add(tblRow)

J
 
Old March 4th, 2004, 12:23 PM
Authorized User
 
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi.. Katsrosj...

still problem is not getting solve ...
should i have to send you whole code and screen shot in the file via email..
can you help me out that why ...
thanks
aashish

Aashish Shah
 
Old March 4th, 2004, 01:07 PM
Authorized User
 
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

More over I am using the data Grid control ..
so what I have to do ?
thanks
aashish

Aashish Shah
 
Old March 4th, 2004, 01:54 PM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to johnpirkey Send a message via MSN to johnpirkey Send a message via Yahoo to johnpirkey
Default

You might be better off using a Repeater control and manually building your table html by hand. this way - you can control each row's appearance.

You can also very easily insert a blank row between items. The repeater control code might look something like this: (each row has blank row following it, and the background color alternates - just like the datagrid probably does.
Code:
<table>
<asp:Repeater id="rptMain" runat="server">
    <itemTemplate>
    <tr bgcolor=white>
        <td> <%# DataBinder.Eval(Container.DataItem, "ProductName") %> </td>
    </tr>
    <tr>
        <td>&nbsp;</td> 
    </tr>
    </itemTemplate>
    <alternatingItemTemplate>
    <tr bgcolor=silver>
        <td> <%# DataBinder.Eval(Container.DataItem, "ProductName") %> </td>
    </tr>
    <tr>
        <td>&nbsp;</td> 
    </tr>
    </alternatingItemTemplate>
</asp:Repeater>
</table>
For more info, check out the Repeater control in the MSDN.

Hope this helps.

john

MCSD(VB6)
http://www.stlvbug.org
 
Old March 4th, 2004, 02:06 PM
Authorized User
 
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

John..

thanks for your answer..

I dont need that way..
this will create an one blank row after every row..
But I need the blank row after each set of record.. mean

it there are 3 kinds of dvd are there in the shop then it should show all three gether and then blank line then if there is a 2 kind of the vcrs are there in the store then it should show 2 line to gether and then next line should be balnk..
thanks for you support ..
aashish

Aashish Shah
 
Old March 4th, 2004, 03:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Aashish,

I haven't had a need to do this so I really don't have any examples, but just a quick search on Google turned up this:

http://www.dotnetjunkies.com/Tutoria...07AA83574.dcik

It is in C#, but it looks pretty straightforward and shouldn't be hard to duplicate in VB. Sorry I couldn't be of assistance.

J
 
Old March 5th, 2004, 09:24 AM
Authorized User
 
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks...
but problem is not solved..

thanks for your support..

aashish

Aashish Shah
 
Old March 5th, 2004, 09:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You can create two subs that bind to two datagrids; one for dvd players and one for vcrs. Your sql statement will separate the two - WHERE productname = 'DVD' for one sub and WHERE productname = 'VCR' for the other. Put a <br> between the two datagrids.

 
Old March 5th, 2004, 11:05 AM
Authorized User
 
Join Date: Feb 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Stu..
 thanks for help..

But problem is still there..
I am just giving the example of the dvd and vcr..
actual case is like that I am getting the data of the student attendance from the one table. In that table the primary key is define with the combination of the 2 clumns.... which is date and student id..

Now the matter is like that if I get the data from the record set I will get the both date attendanace for the same student I am grouping that field of the student ID .. so I am getting the data of the same student for the different day in subsequent rows.. so I want to differenciate the student by the blank row..
Now if you can help me out STU It will be nice help from you .. I am right behind this thing for 7 days.. but not getting the solution ..

by the way thanks for you idea for 2 data grids.. but in my case it will not work..
thanks
aashish

Aashish Shah





Similar Threads
Thread Thread Starter Forum Replies Last Post
UPDATING 1 row with another row in same table rit01 SQL Server 2000 3 February 19th, 2006 08:55 AM
Help adding a row to a data table. jbenson001 VB.NET 2002/2003 Basics 3 March 30th, 2005 02:12 PM
Manage data row by row in datagrid Dragonist Classic ASP Databases 5 July 29th, 2004 04:17 AM
Blank row in Data Bound ComboBox joblot VB How-To 1 May 5th, 2004 01:33 PM
inser xml data to sql server from asp ak Classic ASP Databases 7 February 25th, 2004 01:05 PM





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