469,908 Members | 2,116 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,908 developers. It's quick & easy.

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.dgStockMasterSummary.RowHeadersVisible = 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 5428
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com> wrote in message
news:UJ*******************@news20.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.dgStockMasterSummary.RowHeadersVisible = 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(System.Data.DataView dvData)

{
dvData.AllowNew = false;

dvData.AllowEdit = false;

dvData.AllowDelete = false;
this.dgStockMasterSummary.ColumnHeadersVisible = false;

DataGridTableStyle tableStyle = new DataGridTableStyle();

tableStyle.MappingName = "DVSummary";

DataGridTextBoxColumn textboxColStyle = null;

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

{

switch(dvData.Table.Columns[i].ColumnName)

{
case "Manufacturer":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Manufacturer";

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

textboxColStyle.Width = 128;

textboxColStyle.WidthChanged +=new
EventHandler(textboxColStyle_WidthChanged);

break;

case "Product Line":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Product Line";

textboxColStyle.Width = 178;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Mill Name":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Mill Name";

textboxColStyle.Width = 177;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Cost":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Cost";

textboxColStyle.Format = "C";

textboxColStyle.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "C&C Price":

textboxColStyle = new DataGridTextBoxColumn();
textboxColStyle.Format = "C";

textboxColStyle.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.HeaderText = "C&C Price";

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Price":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Price";

textboxColStyle.Format = "C";

textboxColStyle.Alignment = System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

}


}

this.dgStockMasterSummary.TableStyles.Clear();

this.dgStockMasterSummary.TableStyles.Add(tableSty le);

this.dgStockMasterSummary.RowHeadersVisible = false;

//this.dgStockMasterSummary.RowHeaderWidth = 10;

this.dgStockMasterSummary.DataSource = dvData;

}
"Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com> wrote in message
news:UJ*******************@news20.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.dgStockMasterSummary.RowHeadersVisible =
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 RowHeadersVisible property on the TableStyle to be false
:)

tableStyle.RowHeadersVisible = false;

HTH

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

public void LoadGridData(System.Data.DataView dvData)

{
dvData.AllowNew = false;

dvData.AllowEdit = false;

dvData.AllowDelete = false;
this.dgStockMasterSummary.ColumnHeadersVisible = false;

DataGridTableStyle tableStyle = new DataGridTableStyle();

tableStyle.MappingName = "DVSummary";

DataGridTextBoxColumn textboxColStyle = null;

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

{

switch(dvData.Table.Columns[i].ColumnName)

{
case "Manufacturer":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Manufacturer";

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

textboxColStyle.Width = 128;

textboxColStyle.WidthChanged +=new
EventHandler(textboxColStyle_WidthChanged);

break;

case "Product Line":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Product Line";

textboxColStyle.Width = 178;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Mill Name":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Mill Name";

textboxColStyle.Width = 177;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Cost":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Cost";

textboxColStyle.Format = "C";

textboxColStyle.Alignment =
System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "C&C Price":

textboxColStyle = new DataGridTextBoxColumn();
textboxColStyle.Format = "C";

textboxColStyle.Alignment =
System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.HeaderText = "C&C Price";

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Price":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Price";

textboxColStyle.Format = "C";

textboxColStyle.Alignment =
System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

}


}

this.dgStockMasterSummary.TableStyles.Clear();

this.dgStockMasterSummary.TableStyles.Add(tableSty le);

this.dgStockMasterSummary.RowHeadersVisible = false;

//this.dgStockMasterSummary.RowHeaderWidth = 10;

this.dgStockMasterSummary.DataSource = dvData;

}
"Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com> wrote in message
news:UJ*******************@news20.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.dgStockMasterSummary.RowHeadersVisible =
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**********@phoneanalyser.net> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
You haven't set the RowHeadersVisible property on the TableStyle to be
false :)

tableStyle.RowHeadersVisible = false;

HTH

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

public void LoadGridData(System.Data.DataView dvData)

{
dvData.AllowNew = false;

dvData.AllowEdit = false;

dvData.AllowDelete = false;
this.dgStockMasterSummary.ColumnHeadersVisible = false;

DataGridTableStyle tableStyle = new DataGridTableStyle();

tableStyle.MappingName = "DVSummary";

DataGridTextBoxColumn textboxColStyle = null;

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

{

switch(dvData.Table.Columns[i].ColumnName)

{
case "Manufacturer":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Manufacturer";

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

textboxColStyle.Width = 128;

textboxColStyle.WidthChanged +=new
EventHandler(textboxColStyle_WidthChanged);

break;

case "Product Line":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Product Line";

textboxColStyle.Width = 178;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Mill Name":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Mill Name";

textboxColStyle.Width = 177;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Cost":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Cost";

textboxColStyle.Format = "C";

textboxColStyle.Alignment =
System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "C&C Price":

textboxColStyle = new DataGridTextBoxColumn();
textboxColStyle.Format = "C";

textboxColStyle.Alignment =
System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.HeaderText = "C&C Price";

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

case "Price":

textboxColStyle = new DataGridTextBoxColumn();

textboxColStyle.HeaderText = "Price";

textboxColStyle.Format = "C";

textboxColStyle.Alignment =
System.Windows.Forms.HorizontalAlignment.Right;

textboxColStyle.Width = 115;

textboxColStyle.MappingName = dvData.Table.Columns[i].ColumnName;

tableStyle.GridColumnStyles.Add(textboxColStyle);

break;

}


}

this.dgStockMasterSummary.TableStyles.Clear();

this.dgStockMasterSummary.TableStyles.Add(tableSty le);

this.dgStockMasterSummary.RowHeadersVisible = false;

//this.dgStockMasterSummary.RowHeaderWidth = 10;

this.dgStockMasterSummary.DataSource = dvData;

}
"Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
news:eE*************@TK2MSFTNGP12.phx.gbl...
It should work fine can you post the example code?

HTH

Ollie Riches
"Tim" <ti*@home.com> wrote in message
news:UJ*******************@news20.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.dgStockMasterSummary.RowHeadersVisible
= 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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by jez123456 | last post: by
1 post views Thread by Asha | last post: by
7 posts views Thread by JIM.H. | last post: by
reply views Thread by Baren | last post: by
3 posts views Thread by Franck | last post: by
1 post views Thread by Piyush | last post: by
1 post views Thread by Jose | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.