473,395 Members | 1,488 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,395 software developers and data experts.

c# datagrid does not set GridColumnStyles

I am using c#.net 2003 and have an an application with a datagrid. The
binding is with an array of structs. Everything works ok except the header
text is the struct element names and they override any GridColumnStyles
properties I set. Additionally, the GridColumnStyles width I set does not get
updated on the datagrid. Any other user have this problem or some insight
into what may be going on.
Thanks,
Jim
Nov 16 '05 #1
2 4657
I have had a number of problems with custom styles but to help you please
attach code for reviewal
"Jim Dougherty" <Ji**********@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
I am using c#.net 2003 and have an an application with a datagrid. The
binding is with an array of structs. Everything works ok except the header
text is the struct element names and they override any GridColumnStyles
properties I set. Additionally, the GridColumnStyles width I set does not get updated on the datagrid. Any other user have this problem or some insight
into what may be going on.
Thanks,
Jim

Nov 16 '05 #2
Here is the code from a button_click event:
//Populate the struct array
data[0].SetData("Iin", "Input Current");
data[1].SetData("Vo_HLNL_pct", "High line full load output voltage");

//Create new table style and mapping name
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "Table";

//Create STEP column styles, mapping name and header text
//Bug: header text does not show...Width not changed
DataGridTextBoxColumn cs1 = new DataGridTextBoxColumn();
cs1.MappingName="STEP";
cs1.HeaderText="STEPXxxx";
cs1.Alignment=HorizontalAlignment.Center;
cs1.Width=200;
ts.GridColumnStyles.Add(cs1);

//Create STEP column styles, mapping name and header text
//Bug: Width not changed
DataGridTextBoxColumn cs2 = new DataGridTextBoxColumn();
cs2.MappingName="STEP_DESCRIPTION";
cs2.HeaderText="STEPX_DESCRIPTION";
cs2.Alignment=HorizontalAlignment.Center;
cs2.Width=200;
ts.GridColumnStyles.Add(cs2);

// Add the tablestyle to the datagrid adn bind
dataGrid1.TableStyles.Add(ts);
dataGrid1.DataSource=data;
currencyManager = (CurrencyManager)dataGrid1.BindingContext[data];

Thanks for any help you can give
Jim

"Darryn Ross" wrote:
I have had a number of problems with custom styles but to help you please
attach code for reviewal
"Jim Dougherty" <Ji**********@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
I am using c#.net 2003 and have an an application with a datagrid. The
binding is with an array of structs. Everything works ok except the header
text is the struct element names and they override any GridColumnStyles
properties I set. Additionally, the GridColumnStyles width I set does not

get
updated on the datagrid. Any other user have this problem or some insight
into what may be going on.
Thanks,
Jim


Nov 16 '05 #3

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

Similar topics

3
by: Job Lot | last post by:
I am trying to implement searchable DataGrid. I am creating a DataSet object with DataRelation on form load, as follows: Private Sub BindDataGrid() Dim planTS As New DataGridTableStyle Dim appTS...
0
by: Job Lot | last post by:
I have an Expense Data Entry form which contains a DataGrid showing various expense categories. There are three columns Description, Cash Exp, Credit Exp, where Description column is readonly. ...
0
by: Morné | last post by:
Hi how do I validate a text value in a datagrid e.g. the user is only allowed to type in a Y or a N. I specifically have a problem with using the PropertyDescriptorCollection. I get the...
3
by: Peter | last post by:
I have a datagrid on WinForm and I am trying to format the Grid. I am using the following code, the code runs fine, but nothing happens after it runs, the datagrid does not change (with data in the...
24
by: Mike L | last post by:
This is for a Win form, in C# 2005. I want to load a datagrid, make some columns width 0, and then clean out the record I added. I get the error message, ""Index was out of range. Must be...
4
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid...
4
by: ElenaR | last post by:
I am having two issues with my datagrid. First, my column headers are not displaying. Second, the grid runs and displays correctly (except the headers) the first time. When the grid runs for the...
17
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5...
3
by: Aziz | last post by:
1. I have a shopping basket DataGrid with a list of products. What I want to do is when the user clicks on a row, a button will become visible/be created that allows user to edit the quantity. The...
6
by: Doug Bell | last post by:
Hi I have a DataGrid with some hidden columns and also some read Only and some ComboBox Columns. Sandard Tabbing through the Datagrid sees the focus go to the hidden columns requiring further...
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: 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
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.