473,385 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataGrid - 2 table comparisons

Are there any add-on products or samples available that can do the following
in an vb.net datagrid

I want to compare 2 rows in a datagrid - one row from one database and
another row for another database.

So all the even rows would be from database one.
All the odd rows would be from database two.

Row one and two will have different formats and colors.

I want to edit either row.

Thanks

Dave


Nov 21 '05 #1
7 5645
Dave,

The datagrid is a representation on screen for the user of data in a
datasource, so I don't understand what you want to do.

There are thousands of methods to compare the data in the underlaying
datasource.

What is it you want to do?

Cor
Are there any add-on products or samples available that can do the
following
in an vb.net datagrid

I want to compare 2 rows in a datagrid - one row from one database and
another row for another database.

So all the even rows would be from database one.
All the odd rows would be from database two.

Row one and two will have different formats and colors.

I want to edit either row.

Thanks

Dave

Nov 21 '05 #2
I want to see 2 tables in the same datagrid -

the odd rows will show table 1
the even row will show table 2

i won't to be able to format the even rows differenently then the odd rows.
Formatting including lines and collors.

The even rows will show data only if is differently then odd rows.

thanks

Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Dave,

The datagrid is a representation on screen for the user of data in a
datasource, so I don't understand what you want to do.

There are thousands of methods to compare the data in the underlaying
datasource.

What is it you want to do?

Cor
Are there any add-on products or samples available that can do the
following
in an vb.net datagrid

I want to compare 2 rows in a datagrid - one row from one database and
another row for another database.

So all the even rows would be from database one.
All the odd rows would be from database two.

Row one and two will have different formats and colors.

I want to edit either row.

Thanks

Dave


Nov 21 '05 #3
Hi Dave,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that this issue involves 2 problems. One is
how to merge two tables' data into one, and the other is how to make the
even and odd rows display with the different formats. If there is any
misunderstanding, please feel free to let me know.

To merge data, there is no direct method to achieve this. We have to create
a new data table, and copy rows from the two tables one by one.

We can also use DataGrid's AlternatingBackColor and AlternatingItemStyle
property to change the format for odd rows. Here is a sample code snippet.

private void CopyDefaultTableStyle(DataGrid datagrid,
DataGridTableStyle ts)
{
ts.AllowSorting = datagrid.AllowSorting;
ts.AlternatingBackColor = datagrid.AlternatingBackColor;
ts.BackColor = datagrid.BackColor;
ts.ColumnHeadersVisible = datagrid.ColumnHeadersVisible;
ts.ForeColor = datagrid.ForeColor;
ts.GridLineColor = datagrid.GridLineColor;
ts.GridLineStyle = datagrid.GridLineStyle;
ts.HeaderBackColor = datagrid.HeaderBackColor;
ts.HeaderFont = datagrid.HeaderFont;
ts.HeaderForeColor = datagrid.HeaderForeColor;
ts.LinkColor = datagrid.LinkColor;
ts.PreferredColumnWidth = datagrid.PreferredColumnWidth;
ts.PreferredRowHeight = datagrid.PreferredRowHeight;
ts.ReadOnly = datagrid.ReadOnly;
ts.RowHeadersVisible = datagrid.RowHeadersVisible;
ts.RowHeaderWidth = datagrid.RowHeaderWidth;
ts.SelectionBackColor = datagrid.SelectionBackColor;
ts.SelectionForeColor = datagrid.SelectionForeColor;
}

For more information, please check the following article.

http://msdn.microsoft.com/msdnmag/is.../08/datagrids/

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 21 '05 #4
Dave,

Beside that Kevin did give you an answer in C# did he you in my opinion the
right answer. When he had not used the method headers, { ; and } he had
given VBNet code.

When you have problems how to build that thirth table, reply than. I think
that it is good to give a distinct in the rows from the new table by using
an extra column where you put in the code 1 and 2. I thought with that you
could not standard create a different color in the basic datagridrows,
however there are as far as I know posibilities and because Ken does that
forever we have than to wait (when he knows that) on his answer for the
right link or code.

Cor
"Dave" <Da**********@hotmail.com>
I want to see 2 tables in the same datagrid -

the odd rows will show table 1
the even row will show table 2

i won't to be able to format the even rows differenently then the odd
rows.
Formatting including lines and collors.

The even rows will show data only if is differently then odd rows.

thanks

Dave

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Dave,

The datagrid is a representation on screen for the user of data in a
datasource, so I don't understand what you want to do.

There are thousands of methods to compare the data in the underlaying
datasource.

What is it you want to do?

Cor
> Are there any add-on products or samples available that can do the
> following
> in an vb.net datagrid
>
> I want to compare 2 rows in a datagrid - one row from one database and
> another row for another database.
>
> So all the even rows would be from database one.
> All the odd rows would be from database two.
>
> Row one and two will have different formats and colors.
>
> I want to edit either row.
>
> Thanks
>
> Dave
>
>
>
>



Nov 21 '05 #5
I propably approched this problem incorrectly.

A more efficient way of doing what i need it is to put the data in 1 row -
but dispaly the data in the datagrid in 2 rows.

Is they way to do this with Microsoft datagrid - it look like there are
someother third pary datagrids that allow you to display 1 row of data into
2 rows on the datagrid.

thanks

Dave


"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:$e**************@cpmsftngxa06.phx.gbl...
Hi Dave,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that this issue involves 2 problems. One is
how to merge two tables' data into one, and the other is how to make the
even and odd rows display with the different formats. If there is any
misunderstanding, please feel free to let me know.

To merge data, there is no direct method to achieve this. We have to create a new data table, and copy rows from the two tables one by one.

We can also use DataGrid's AlternatingBackColor and AlternatingItemStyle
property to change the format for odd rows. Here is a sample code snippet.

private void CopyDefaultTableStyle(DataGrid datagrid,
DataGridTableStyle ts)
{
ts.AllowSorting = datagrid.AllowSorting;
ts.AlternatingBackColor = datagrid.AlternatingBackColor;
ts.BackColor = datagrid.BackColor;
ts.ColumnHeadersVisible = datagrid.ColumnHeadersVisible;
ts.ForeColor = datagrid.ForeColor;
ts.GridLineColor = datagrid.GridLineColor;
ts.GridLineStyle = datagrid.GridLineStyle;
ts.HeaderBackColor = datagrid.HeaderBackColor;
ts.HeaderFont = datagrid.HeaderFont;
ts.HeaderForeColor = datagrid.HeaderForeColor;
ts.LinkColor = datagrid.LinkColor;
ts.PreferredColumnWidth = datagrid.PreferredColumnWidth;
ts.PreferredRowHeight = datagrid.PreferredRowHeight;
ts.ReadOnly = datagrid.ReadOnly;
ts.RowHeadersVisible = datagrid.RowHeadersVisible;
ts.RowHeaderWidth = datagrid.RowHeaderWidth;
ts.SelectionBackColor = datagrid.SelectionBackColor;
ts.SelectionForeColor = datagrid.SelectionForeColor;
}

For more information, please check the following article.

http://msdn.microsoft.com/msdnmag/is.../08/datagrids/

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 21 '05 #6
Hi Dave,

As far as I know, we cannot do this with MS's datagrid. Maybe there is some
3rd-party controls to achieve this. Or you can try to inherit from the
current data grid and implement your own. :)

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 21 '05 #7
There is a way to do it.
1. Make the last column of datagrid a template column.
2. Add placeholder as last control in template column
3. Build a function RowFunc() that returns a complete HTML row except
the last starting with <TR><TD>, but does not return the very
last"</td></tr>"
4. in itemdatabinding function say something like
PlaceHolder.Controls.add(New literalcontrol("</td></tr>"))
5. Placeholder.Controls.add(new literalcontrol(RowFunc()))
6. Datagrid will automatically add closing table cell and table row
tags because it is clueless about us inserting another row

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official...
1
by: VAhid Mardani | last post by:
HI ; When I Bind The Datagrid To a Dataview In the Table Style Collection.Mapping Name Not have any table name; please tell me How To Change Datagrid Table Style When It was Binded to A Dataview...
1
by: martin | last post by:
Hi, I have a datagrid that contains 3 colums. This is rendered to the page fine, except that I would like to be able to control the width of each table cell of the datagrid I have the following...
1
by: Sam | last post by:
Please advise any good website for reference of datagrid,table and datalist except msdn and www.asp.net I had learned asp.net 1.1 but I still weak at datagrid and table control whereby I...
0
by: DC Gringo | last post by:
I am trying to output simply DataGrid of a coutry listing on a web form via a business object and XML web service...I receive no errors but no table HTML either. (I know the service and business...
0
by: DC Gringo | last post by:
I am trying to output simply DataGrid of a coutry listing on a web form via a business object and XML web service...I receive no errors but no table HTML either. (I know the service and business...
3
by: tjonsek | last post by:
am working on code that will allow users to update data within the datagrid. I have come across a few problems, some of them I have been able to work out, but this last one is giving me trouble. ...
2
by: harini | last post by:
i hv a datagrid to which i hv bound a table...i hv the table columns to be editable...i.e read only = false....now i hv a problem...in the table there seems to be a row at the end having no values...
1
by: ashwinigopi | last post by:
I have two forms, form1 & form 2. Form1 has datagridview. I am not supposed use any sql command in form1. So i added form2 and wrote the sql commands using stored procedures to get the data from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.