473,405 Members | 2,287 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,405 software developers and data experts.

DataGridColumnStyles issue

jvb
Hey all,

I am getting this message when trying to view data in my datagrid:

....DataGridColumnStyle cannot be used because it is not associated with
a Property or Column in the DataSource.

Here is the skinny...

1. The tablestyle that it is puking on is a manually created table in
code.
2. The tablestyle will display correctly in the grid if it is set as
the direct datasourece and not
as a child table.
3. If i do not apply the tablestyle to the grid for this table, the
relation will display correctly.

The form operates correctly until I try to expand the grid.

Any thoughts?

Here is the code that creates the table and the table styles. The
Customers table is populated via a SQL query.

Private Function CreateOrderTable(ByVal TableName As String) As
DataTable

Dim ReturnTable As New DataTable(TableName)

ReturnTable.Columns.Add(New DataColumn("order_id",
GetType(System.Int32)))
ReturnTable.Columns.Add(New DataColumn("customer_id",
GetType(System.Int32)))
ReturnTable.Columns.Add(New DataColumn("order_number",
GetType(System.Int32)))
ReturnTable.Columns.Add(New DataColumn("order_quantity",
GetType(System.Int32)))
ReturnTable.Columns.Add(New DataColumn("order_date",
GetType(System.DateTime)))
ReturnTable.Columns.Add(New DataColumn("ship_date",
GetType(System.DateTime)))

ReturnTable.Columns("trade_id").ColumnMapping =
MappingType.Hidden

ReturnTable.Columns("order_date").DefaultValue =
Me.dtpOrderDate.Value
ReturnTable.Columns("ship_date").DefaultValue =
Me.dtpShipDate.Value

Return ReturnTable

End Function

Private Function CreateOrderTableStyle(ByVal MappingName As String) As
DataGridTableStyle
Dim ReturnStyle As New DataGridTableStyle

ReturnStyle.MappingName = MappingName
ReturnStyle.GridColumnStyles.Add(CustomControls.Co mmonInteraction.CreateTextBoxColumn("order_quantit y",
"Quantity", 100))

ReturnStyle.GridColumnStyles.Add(CustomControls.Co mmonInteraction.CreateTextBoxColumn("order_number" ,
"Order Number", 100))

ReturnStyle.GridColumnStyles.Add(CustomControls.Co mmonInteraction.CreateTextBoxColumn("order_date",
"Order Date", 100, "d"))

ReturnStyle.GridColumnStyles.Add(CustomControls.Co mmonInteraction.CreateTextBoxColumn("ship_date",
"Ship Date", 100, "d"))

Return ReturnStyle

End Function

Private Sub ShowTime()

Me.dgSales.DataSource = Me.SalesDataSet

Me.dgSales.TableStyles.Add(Me.CreateSalesTableStyl e("Customers"))

Me.dgSales.TableStyles.Add(Me.CreateManualSalesTab leStyle("Orders"))

End Sub
Thanks,

jvb

Mar 1 '06 #1
1 1171
jvb
NVM, i figured out my issue. I was giving the MappingName the name of
the table, not the name of the relation.

Mar 1 '06 #2

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

Similar topics

7
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with...
2
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the...
2
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We...
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.