Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2005

Tip: Looking for answers? Try searching our database.

How to set Grid properties?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brett Romero - 20 Dec 2005 22:10 GMT
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
Robbe Morris [C# MVP] - 20 Dec 2005 23:30 GMT
What you have should work.  Where is gridTableStyle
defined???

> public void BindDataGridTableSyle(DataGrid myGrid)
>  {
>   myGrid.TableStyles.Clear();
>   myGrid.TableStyles.Add(gridTableStyle);
>  }

Signature

Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

> 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
[quoted text clipped - 22 lines]
> Thanks,
> Brett
Brett Romero - 20 Dec 2005 23:32 GMT
In DataGridOperation.cs.  I don't see the mapping changes coming
through on the calling form.
Brett Romero - 21 Dec 2005 01:20 GMT
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
Brett Romero - 21 Dec 2005 18:56 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.