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

How to set Grid properties?

I'd like to set certain grid properties generically. Meaning, I have a
method located in an independent class, pass in the particular grid and
have certain properties set. The problem is that I'm not sure how to
get the grid with those set properties back to the calling class. For
example:

DataGridOperation.cs:

public void BindDataGridTableSyle(DataGrid myGrid)
{
myGrid.TableStyles.Clear();
myGrid.TableStyles.Add(gridTableStyle);
}
Form1.cs:

DataGridOperation dgo = new DataGridOperation();
dgo.BindDataGridTableStyle(DataGrid1);
DataGrid1.DataSource = SomeDataTable;

The problem is the properties set in the above method are not coming
through in the grid. Do I need to return myGrid from the method? How
does that work because I'll then have DataGrid1 plus some other method.

Thanks,
Brett

Dec 20 '05 #1
4 1456
What you have should work. Where is gridTableStyle
defined???

public void BindDataGridTableSyle(DataGrid myGrid)
{
myGrid.TableStyles.Clear();
myGrid.TableStyles.Add(gridTableStyle);
}
--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

"Brett Romero" <ac*****@cygen.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com... I'd like to set certain grid properties generically. Meaning, I have a
method located in an independent class, pass in the particular grid and
have certain properties set. The problem is that I'm not sure how to
get the grid with those set properties back to the calling class. For
example:

DataGridOperation.cs:

public void BindDataGridTableSyle(DataGrid myGrid)
{
myGrid.TableStyles.Clear();
myGrid.TableStyles.Add(gridTableStyle);
}
Form1.cs:

DataGridOperation dgo = new DataGridOperation();
dgo.BindDataGridTableStyle(DataGrid1);
DataGrid1.DataSource = SomeDataTable;

The problem is the properties set in the above method are not coming
through in the grid. Do I need to return myGrid from the method? How
does that work because I'll then have DataGrid1 plus some other method.

Thanks,
Brett

Dec 20 '05 #2
In DataGridOperation.cs. I don't see the mapping changes coming
through on the calling form.

Dec 20 '05 #3
Actally, the dataset I'm using as a source is empty and not returning
the column I need anyway. I'll adjust this and see what happens.

Thanks,
Brett

Dec 21 '05 #4
Actually, regardless of what the dataset returns, shouldn't the table
style take affect on the grid? Or, if a single mapped column is
missing, will that break the table style and it won't come through in
the grid?

Thanks,
Brett

Dec 21 '05 #5

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

Similar topics

3
by: Martin Montgomery | last post by:
I have, for example, a property called myProperty. I would like, when using a property grid to display the property name as "My Property". Is this possible. Is there an attribute etc Thank ...
0
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
1
by: John Kraft | last post by:
Hi all, I'm trying to use a property grid, and what I'm trying to do seems to really elude me. I've been using the property grid for a short period of time, and this is the first thing I...
6
by: Ron M. Newman | last post by:
Hi, I have a problem with dynamically putting dynamic properties on the property grid. My app has no idea what it'll be showing at compile time. How do I dynamically add properties to the...
4
by: Marc Gravell | last post by:
Well, what exactly do you want to do? PropertyGrid is really at the whim of System.ComponentModel - and there are various ways of investigating properties; the most common being...
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
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?
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
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
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...

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.