473,651 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide Datagrid Row Header...?

Tim
Hi,

I am trying to hide the datagrid row header (the left most column that has
the 'select' triangle in it which moves with the selected row). It seems to
be fairly simple; this.dgStockMas terSummary.RowH eadersVisible = false;

however it doesn't hide it. Hiding the column headers works just fine.

Does anyone have any ideas?

Tim
Nov 17 '05 #1
4 5683
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com > wrote in message
news:UJ******** ***********@new s20.bellglobal. com...
Hi,

I am trying to hide the datagrid row header (the left most column that has
the 'select' triangle in it which moves with the selected row). It seems
to be fairly simple; this.dgStockMas terSummary.RowH eadersVisible = false;

however it doesn't hide it. Hiding the column headers works just fine.

Does anyone have any ideas?

Tim

Nov 17 '05 #2
Tim
Code is below Ollie;

public void LoadGridData(Sy stem.Data.DataV iew dvData)

{
dvData.AllowNew = false;

dvData.AllowEdi t = false;

dvData.AllowDel ete = false;
this.dgStockMas terSummary.Colu mnHeadersVisibl e = false;

DataGridTableSt yle tableStyle = new DataGridTableSt yle();

tableStyle.Mapp ingName = "DVSummary" ;

DataGridTextBox Column textboxColStyle = null;

for(int i = 0; i<dvData.Table. Columns.Count; i++)

{

switch(dvData.T able.Columns[i].ColumnName)

{
case "Manufactur er":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Manufactur er";

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

textboxColStyle .Width = 128;

textboxColStyle .WidthChanged +=new
EventHandler(te xtboxColStyle_W idthChanged);

break;

case "Product Line":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Product Line";

textboxColStyle .Width = 178;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Mill Name":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Mill Name";

textboxColStyle .Width = 177;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Cost":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Cost";

textboxColStyle .Format = "C";

textboxColStyle .Alignment = System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "C&C Price":

textboxColStyle = new DataGridTextBox Column();
textboxColStyle .Format = "C";

textboxColStyle .Alignment = System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .HeaderText = "C&C Price";

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Price":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Price";

textboxColStyle .Format = "C";

textboxColStyle .Alignment = System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

}


}

this.dgStockMas terSummary.Tabl eStyles.Clear() ;

this.dgStockMas terSummary.Tabl eStyles.Add(tab leStyle);

this.dgStockMas terSummary.RowH eadersVisible = false;

//this.dgStockMas terSummary.RowH eaderWidth = 10;

this.dgStockMas terSummary.Data Source = dvData;

}
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eE******** *****@TK2MSFTNG P12.phx.gbl...
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com > wrote in message
news:UJ******** ***********@new s20.bellglobal. com...
Hi,

I am trying to hide the datagrid row header (the left most column that
has the 'select' triangle in it which moves with the selected row). It
seems to be fairly simple; this.dgStockMas terSummary.RowH eadersVisible =
false;

however it doesn't hide it. Hiding the column headers works just fine.

Does anyone have any ideas?

Tim


Nov 17 '05 #3
You haven't set the RowHeadersVisib le property on the TableStyle to be false
:)

tableStyle.RowH eadersVisible = false;

HTH

Ollie Riches
"Tim" <ti*@home.com > wrote in message
news:iS******** ***********@new s20.bellglobal. com...
Code is below Ollie;

public void LoadGridData(Sy stem.Data.DataV iew dvData)

{
dvData.AllowNew = false;

dvData.AllowEdi t = false;

dvData.AllowDel ete = false;
this.dgStockMas terSummary.Colu mnHeadersVisibl e = false;

DataGridTableSt yle tableStyle = new DataGridTableSt yle();

tableStyle.Mapp ingName = "DVSummary" ;

DataGridTextBox Column textboxColStyle = null;

for(int i = 0; i<dvData.Table. Columns.Count; i++)

{

switch(dvData.T able.Columns[i].ColumnName)

{
case "Manufactur er":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Manufactur er";

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

textboxColStyle .Width = 128;

textboxColStyle .WidthChanged +=new
EventHandler(te xtboxColStyle_W idthChanged);

break;

case "Product Line":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Product Line";

textboxColStyle .Width = 178;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Mill Name":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Mill Name";

textboxColStyle .Width = 177;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Cost":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Cost";

textboxColStyle .Format = "C";

textboxColStyle .Alignment =
System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "C&C Price":

textboxColStyle = new DataGridTextBox Column();
textboxColStyle .Format = "C";

textboxColStyle .Alignment =
System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .HeaderText = "C&C Price";

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Price":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Price";

textboxColStyle .Format = "C";

textboxColStyle .Alignment =
System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

}


}

this.dgStockMas terSummary.Tabl eStyles.Clear() ;

this.dgStockMas terSummary.Tabl eStyles.Add(tab leStyle);

this.dgStockMas terSummary.RowH eadersVisible = false;

//this.dgStockMas terSummary.RowH eaderWidth = 10;

this.dgStockMas terSummary.Data Source = dvData;

}
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eE******** *****@TK2MSFTNG P12.phx.gbl...
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com > wrote in message
news:UJ******** ***********@new s20.bellglobal. com...
Hi,

I am trying to hide the datagrid row header (the left most column that
has the 'select' triangle in it which moves with the selected row). It
seems to be fairly simple; this.dgStockMas terSummary.RowH eadersVisible =
false;

however it doesn't hide it. Hiding the column headers works just fine.

Does anyone have any ideas?

Tim



Nov 17 '05 #4
Tim
Thank you Ollie, that was it!

Tim

"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
You haven't set the RowHeadersVisib le property on the TableStyle to be
false :)

tableStyle.RowH eadersVisible = false;

HTH

Ollie Riches
"Tim" <ti*@home.com > wrote in message
news:iS******** ***********@new s20.bellglobal. com...
Code is below Ollie;

public void LoadGridData(Sy stem.Data.DataV iew dvData)

{
dvData.AllowNew = false;

dvData.AllowEdi t = false;

dvData.AllowDel ete = false;
this.dgStockMas terSummary.Colu mnHeadersVisibl e = false;

DataGridTableSt yle tableStyle = new DataGridTableSt yle();

tableStyle.Mapp ingName = "DVSummary" ;

DataGridTextBox Column textboxColStyle = null;

for(int i = 0; i<dvData.Table. Columns.Count; i++)

{

switch(dvData.T able.Columns[i].ColumnName)

{
case "Manufactur er":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Manufactur er";

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

textboxColStyle .Width = 128;

textboxColStyle .WidthChanged +=new
EventHandler(te xtboxColStyle_W idthChanged);

break;

case "Product Line":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Product Line";

textboxColStyle .Width = 178;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Mill Name":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Mill Name";

textboxColStyle .Width = 177;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Cost":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Cost";

textboxColStyle .Format = "C";

textboxColStyle .Alignment =
System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "C&C Price":

textboxColStyle = new DataGridTextBox Column();
textboxColStyle .Format = "C";

textboxColStyle .Alignment =
System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .HeaderText = "C&C Price";

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

case "Price":

textboxColStyle = new DataGridTextBox Column();

textboxColStyle .HeaderText = "Price";

textboxColStyle .Format = "C";

textboxColStyle .Alignment =
System.Windows. Forms.Horizonta lAlignment.Righ t;

textboxColStyle .Width = 115;

textboxColStyle .MappingName = dvData.Table.Co lumns[i].ColumnName;

tableStyle.Grid ColumnStyles.Ad d(textboxColSty le);

break;

}


}

this.dgStockMas terSummary.Tabl eStyles.Clear() ;

this.dgStockMas terSummary.Tabl eStyles.Add(tab leStyle);

this.dgStockMas terSummary.RowH eadersVisible = false;

//this.dgStockMas terSummary.RowH eaderWidth = 10;

this.dgStockMas terSummary.Data Source = dvData;

}
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eE******** *****@TK2MSFTNG P12.phx.gbl...
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com > wrote in message
news:UJ******** ***********@new s20.bellglobal. com...
Hi,

I am trying to hide the datagrid row header (the left most column that
has the 'select' triangle in it which moves with the selected row). It
seems to be fairly simple; this.dgStockMas terSummary.RowH eadersVisible
= false;

however it doesn't hide it. Hiding the column headers works just fine.

Does anyone have any ideas?

Tim



Nov 17 '05 #5

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

Similar topics

4
4082
by: jez123456 | last post by:
Not sure if I'm in the right thread but here goes. I have an ASP.Net web page with a datagrid. The code behind is C#. If the datagrid has no records the datagrid header section is still shown. What I need is to hide all of the datagrid if there are no records.
0
1585
by: shnuber | last post by:
I need to add a 'check all' check box in my datagrid header column... I have my datagrids already made with table styles etc. I presume I'll have to override the DataGrid with my own implementation? This is for a Windows Form application, not ASP.NET. Any examples would be great... Thanks in advance
1
1295
by: Asha | last post by:
hello, dgNameFound.Items.Cells.Visiable= false; i'm using this to hide the items in a datagrid and it works fine... but i do not know how to hide the header of the column. can someone please show me how this is done?
0
1066
by: yezanxiong | last post by:
My datagrid is built by coding, based on template table, and item has checkbox, label, and textbox. I set 10 rows in one page. and I can also set the width value for each column. Because if datagrid only have 1 or 2 records, the height of each row is much heigher than it's regular. I guess it is the problem that on each row it has checkbox, textbox and label combined. Is that anyone meet this before? and how to set the height value for...
7
3286
by: JIM.H. | last post by:
Hello, Is it possible to change a datagrid Header and Footer text in code behind dynamically? Thanks, Jim.
0
1014
by: Baren | last post by:
Hi! I have defined some style sheet for the DataGrid Header. It works fine in IE, But Netscape 6.2 doesn't display the DataGrid Properly. Its missing the Header Style. My style Sheet ...grdHeaderClass, .grdHeaderClass td, .grdHeaderClass a, .grdHeaderClass a:link, .grdHeaderClass a:visited, .grdHeaderClass a:hover {
3
2637
by: Franck | last post by:
hello, I'm trying to add a tooltip at the datagrid header but I don't know where to start? I tought about a template column but i only wish to have the tooltip on the header? any help? thank you
0
2618
by: cedoucette | last post by:
I just wrote code to support sortable columns in a datagrid. It seems to work fine; but, it doesn't look right. The problem is that I have a generic style for links and a different style for the header row - and they conflict. The sortable column apparently uses the generic style for <a> elements and the rest of the header uses "headerRow". Can anyone tell me how to get consistent styles for each column in my datagrid header?
1
1161
by: Piyush | last post by:
Hi there! With the datagriditem object, I believe we can't access the cells in the datagrid header. Any pointers on how this can be achieved? I am looking at an approach without using the itemcreated event of the datagrid, which I have already implemented. Regards, Piyush
1
1845
by: Jose | last post by:
Please como center a datagrid header and the data justify to right? Thanks a lot
0
8357
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8277
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8803
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.