473,385 Members | 1,312 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.

Q: DataGrid

Hi

It is possible to associate several TableStyles with one DataGrid e.g.

Dim tableStyle1 As New DataGridTableStyle
Dim tableStyle2 As New DataGridTableStyle

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

When the grid is displayed, will it be the first Table Style that is used?
Also, how do I get the DataGrid to display the other table style?

Thanks in advance

Geoff
Nov 21 '05 #1
4 1099
According to DataGridTableStyle.MappingName will automatically pickup a
DataGridTableStyle. For Example:

dim Tb1 as new dataTable("Name1")
....
dim Tb2 as new dataTable("Name2")
....

Dim tableStyle1 As New DataGridTableStyle
tableStyle1.MappingName ="Name1"

Dim tableStyle2 As New DataGridTableStyle
tableStyle2.MappingName ="Name2"

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

DataGrid1.DataSource=Tb1 'Use tableStyle1
DataGrid2.DataSource=Tb2 'Use tableStyle2

"Geoff Jones" wrote:
Hi

It is possible to associate several TableStyles with one DataGrid e.g.

Dim tableStyle1 As New DataGridTableStyle
Dim tableStyle2 As New DataGridTableStyle

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

When the grid is displayed, will it be the first Table Style that is used?
Also, how do I get the DataGrid to display the other table style?

Thanks in advance

Geoff

Nov 21 '05 #2
Hi Rulin

I think you've misunderstood. If I'm adding different styles to the same
DataGrid e.g. DataGrid1, how do I dynamically switch from one style to
another in the code?

Geoff

"Rulin Hong" <Ru*******@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
According to DataGridTableStyle.MappingName will automatically pickup a
DataGridTableStyle. For Example:

dim Tb1 as new dataTable("Name1")
...
dim Tb2 as new dataTable("Name2")
...

Dim tableStyle1 As New DataGridTableStyle
tableStyle1.MappingName ="Name1"

Dim tableStyle2 As New DataGridTableStyle
tableStyle2.MappingName ="Name2"

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

DataGrid1.DataSource=Tb1 'Use tableStyle1
DataGrid2.DataSource=Tb2 'Use tableStyle2

"Geoff Jones" wrote:
Hi

It is possible to associate several TableStyles with one DataGrid e.g.

Dim tableStyle1 As New DataGridTableStyle
Dim tableStyle2 As New DataGridTableStyle

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

When the grid is displayed, will it be the first Table Style that is used? Also, how do I get the DataGrid to display the other table style?

Thanks in advance

Geoff

Nov 21 '05 #3
Geoff,

Be flexible. Changing DataGridTableStyle.MappingName absolutely can meet
your requirement. For example:
Change style from tableStyle1 to tableStyle2

dataGrid1.datasource=nothing
tableStyle1.MappingName =""
tableStyle1.MappingName ="tableName"
dataGrid1.datasource=datatable

"Geoff Jones" wrote:
Hi Rulin

I think you've misunderstood. If I'm adding different styles to the same
DataGrid e.g. DataGrid1, how do I dynamically switch from one style to
another in the code?

Geoff

"Rulin Hong" <Ru*******@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
According to DataGridTableStyle.MappingName will automatically pickup a
DataGridTableStyle. For Example:

dim Tb1 as new dataTable("Name1")
...
dim Tb2 as new dataTable("Name2")
...

Dim tableStyle1 As New DataGridTableStyle
tableStyle1.MappingName ="Name1"

Dim tableStyle2 As New DataGridTableStyle
tableStyle2.MappingName ="Name2"

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

DataGrid1.DataSource=Tb1 'Use tableStyle1
DataGrid2.DataSource=Tb2 'Use tableStyle2

"Geoff Jones" wrote:
Hi

It is possible to associate several TableStyles with one DataGrid e.g.

Dim tableStyle1 As New DataGridTableStyle
Dim tableStyle2 As New DataGridTableStyle

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

When the grid is displayed, will it be the first Table Style that is used? Also, how do I get the DataGrid to display the other table style?

Thanks in advance

Geoff


Nov 21 '05 #4
Ah, I see what you mean. Many thanks

Geoff

"Rulin Hong" <Ru*******@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Geoff,

Be flexible. Changing DataGridTableStyle.MappingName absolutely can meet
your requirement. For example:
Change style from tableStyle1 to tableStyle2

dataGrid1.datasource=nothing
tableStyle1.MappingName =""
tableStyle1.MappingName ="tableName"
dataGrid1.datasource=datatable

"Geoff Jones" wrote:
Hi Rulin

I think you've misunderstood. If I'm adding different styles to the same
DataGrid e.g. DataGrid1, how do I dynamically switch from one style to
another in the code?

Geoff

"Rulin Hong" <Ru*******@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
According to DataGridTableStyle.MappingName will automatically pickup a DataGridTableStyle. For Example:

dim Tb1 as new dataTable("Name1")
...
dim Tb2 as new dataTable("Name2")
...

Dim tableStyle1 As New DataGridTableStyle
tableStyle1.MappingName ="Name1"

Dim tableStyle2 As New DataGridTableStyle
tableStyle2.MappingName ="Name2"

DataGrid1.TableStyle.Add(tableStyle1)
DataGrid1.TableStyle.Add(tableStyle2)

DataGrid1.DataSource=Tb1 'Use tableStyle1
DataGrid2.DataSource=Tb2 'Use tableStyle2

"Geoff Jones" wrote:

> Hi
>
> It is possible to associate several TableStyles with one DataGrid e.g. >
> Dim tableStyle1 As New DataGridTableStyle
> Dim tableStyle2 As New DataGridTableStyle
>
> DataGrid1.TableStyle.Add(tableStyle1)
> DataGrid1.TableStyle.Add(tableStyle2)
>
> When the grid is displayed, will it be the first Table Style that is

used?
> Also, how do I get the DataGrid to display the other table style?
>
> Thanks in advance
>
> Geoff
>
>
>


Nov 21 '05 #5

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
5
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
7
by: Dave | last post by:
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...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.