We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

CellType = "GridListControl" for GridControl

Thread ID:

Created:

Updated:

Platform:

Replies:

58648 Mar 26,2007 04:59 AM Mar 27,2007 01:37 PM Windows Forms 5
loading
Tags: GridControl
Rahul Hans
Asked On March 26, 2007 04:59 AM

HI

I am using the GridControl. I have set the cell type of a particular cell as GridListControl.

The datasource of the gridlistcontrol is a List which in turn has been populated buy iterating thru a datareader.

I need to do the following

1. Change the column headings that i am getting in the dropdown gridlist.

2. I need to optionally hide some columns and not have them displayed in the dropdown GridListControl

I am writing this in a hurry and do hope i have been clear enough.

Any clarifications just get in touch

Thanks a Ton in advance


Saravanan A [Syncfusion]
Replied On March 26, 2007 01:47 PM

Hi RH,

1, Change the column headings that i am getting in the dropdown gridlist.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This can be achieved by changing the cellvalues of the header cells. For this, PrepareViewStyleInfo event of the underlying gridcontrol can be used.
Here is the code snippet.
//In form load
GridDropDownGridListControlCellRenderer renderer = this.gridControl1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer;
renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
..
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex == 0)
{
if (e.Style.CellValue.ToString() == "col2")
{
e.Style.CellValue = "Column2";
}
}
}

2, I need to optionally hide some columns
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Any columns of gridlistcontrol celltype in gridcontrol can be made hidden from the ''CurrentCellShowingDropDown'' Event of gridcontrol.
Here is the code snippets.
void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridDropDownGridListControlCellRenderer renderer = cc.Renderer as GridDropDownGridListControlCellRenderer;
if (renderer != null)
{
renderer.ListControlPart.Grid.HideCols["columnName"] = true;
}
}

Regards,
Saravanan

Rahul Hans
Replied On March 27, 2007 01:32 AM

HI Saravanan

Thanks ! This solves two remaining issues...

It also gives me sufficient inputs to try to solve some more issues which have come up in the meanwhile

>Hi RH,

1, Change the column headings that i am getting in the dropdown gridlist.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This can be achieved by changing the cellvalues of the header cells. For this, PrepareViewStyleInfo event of the underlying gridcontrol can be used.
Here is the code snippet.
//In form load
GridDropDownGridListControlCellRenderer renderer = this.gridControl1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer;
renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
..
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex == 0)
{
if (e.Style.CellValue.ToString() == "col2")
{
e.Style.CellValue = "Column2";
}
}
}

2, I need to optionally hide some columns
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Any columns of gridlistcontrol celltype in gridcontrol can be made hidden from the 'CurrentCellShowingDropDown' Event of gridcontrol.
Here is the code snippets.
void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridDropDownGridListControlCellRenderer renderer = cc.Renderer as GridDropDownGridListControlCellRenderer;
if (renderer != null)
{
renderer.ListControlPart.Grid.HideCols["columnName"] = true;
}
}

Regards,
Saravanan

Rahul Hans
Replied On March 27, 2007 03:55 AM

Hi Saravanan

I need to have some control over the order of columns that appear in the GridListControl.

At the moment I am not able to find out on what basis does the GridListcontrol order the columns.

Just to refresh your memory I am using Gridlistcontrol as a celltype in the gridcontrol.

The datasource is a list which is populated thru a datareader.

I read some in the forumn that deriving gridlistcontrol and overriding CreateGridColumn should do the job, but that isnt working out for me.

Your previous advice helped a lot. I was also able to align and format the columns.

One more thing. How does one access in code the row selected in the GridListControl.

Thanks & Best Regards
RH



>HI Saravanan

Thanks ! This solves two remaining issues...

It also gives me sufficient inputs to try to solve some more issues which have come up in the meanwhile

>Hi RH,

1, Change the column headings that i am getting in the dropdown gridlist.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This can be achieved by changing the cellvalues of the header cells. For this, PrepareViewStyleInfo event of the underlying gridcontrol can be used.
Here is the code snippet.
//In form load
GridDropDownGridListControlCellRenderer renderer = this.gridControl1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer;
renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
..
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex == 0)
{
if (e.Style.CellValue.ToString() == "col2")
{
e.Style.CellValue = "Column2";
}
}
}

2, I need to optionally hide some columns
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Any columns of gridlistcontrol celltype in gridcontrol can be made hidden from the 'CurrentCellShowingDropDown' Event of gridcontrol.
Here is the code snippets.
void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridDropDownGridListControlCellRenderer renderer = cc.Renderer as GridDropDownGridListControlCellRenderer;
if (renderer != null)
{
renderer.ListControlPart.Grid.HideCols["columnName"] = true;
}
}

Regards,
Saravanan

Rahul Hans
Replied On March 27, 2007 03:55 AM

Hi Saravanan

I need to have some control over the order of columns that appear in the GridListControl.

At the moment I am not able to find out on what basis does the GridListcontrol order the columns.

Just to refresh your memory I am using Gridlistcontrol as a celltype in the gridcontrol.

The datasource is a list which is populated thru a datareader.

I read some in the forumn that deriving gridlistcontrol and overriding CreateGridColumn should do the job, but that isnt working out for me.

Your previous advice helped a lot. I was also able to align and format the columns.

One more thing. How does one access in code the row selected in the GridListControl.

Thanks & Best Regards
RH



>HI Saravanan

Thanks ! This solves two remaining issues...

It also gives me sufficient inputs to try to solve some more issues which have come up in the meanwhile

>Hi RH,

1, Change the column headings that i am getting in the dropdown gridlist.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This can be achieved by changing the cellvalues of the header cells. For this, PrepareViewStyleInfo event of the underlying gridcontrol can be used.
Here is the code snippet.
//In form load
GridDropDownGridListControlCellRenderer renderer = this.gridControl1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer;
renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
..
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex == 0)
{
if (e.Style.CellValue.ToString() == "col2")
{
e.Style.CellValue = "Column2";
}
}
}

2, I need to optionally hide some columns
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Any columns of gridlistcontrol celltype in gridcontrol can be made hidden from the 'CurrentCellShowingDropDown' Event of gridcontrol.
Here is the code snippets.
void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridDropDownGridListControlCellRenderer renderer = cc.Renderer as GridDropDownGridListControlCellRenderer;
if (renderer != null)
{
renderer.ListControlPart.Grid.HideCols["columnName"] = true;
}
}

Regards,
Saravanan

Rajagopal [Syncfusion]
Replied On March 27, 2007 01:37 PM

Hi RH,

Your other forum thread with a similar query has been updated. Please followup there for any further queries.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=58736

Thanks for using Syncfusion Products.
Regards,
Rajagopal

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;