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. Image for the cookie policy date

GridListControl cellType customization

Hi,

I have a GridDataBoundGrid with a column CellType set to "GridListControl".

I want to customize this grid ( col width, col align, allow add new, etc).
Who I can do that?

Best regards,

Martin


3 Replies

JJ Jisha Joy Syncfusion Team April 29, 2009 06:21 AM UTC

Hi Martin,

You could handle the CurrentCellShowingDropDown event and can set the properties for ListControlPart. You can refer the grid inside the dropdown by using ListControlPart.Grid property and set the styles by handling PrepareViewStyleInfo event. Please see the code:



void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (cc.Renderer.GetType() == typeof(GridDropDownGridListControlCellRenderer))
{
GridDropDownGridListControlCellRenderer cr = (GridDropDownGridListControlCellRenderer)cc.Renderer;
cr.ListControlPart.AllowResizeColumns = true;
cr.ListControlPart.Grid.ColWidths[2] = 100;
cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);

}
}

void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{

if(e.ColIndex == 2)
{
e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
}


}



Please let me know if you have any questions.
Regards,
Jisha



SU Santosh U July 17, 2009 04:13 PM UTC

Hi Jisha,

This is really great. Only I am not able to get the property where in I can set the dropdowngridlist control AllowNew and AllowEdit property to true.

Can you please help me.
Thanks


JJ Jisha Joy Syncfusion Team September 8, 2009 11:35 AM UTC

Hi Santhosh,

The properties AllowNew and AllowEdit are not available for GridListControl. If your intension is to have editable drop-down grid, then this can be achieved by having drop-down gridcontrol in cell. See the following sample from our sample browser for more information:

\My Documents\syncfusion\essentialstudio\7.3.0.20\Windows\Grid.Windows\Samples\2.0\Custom Cell Type\Drop-Down Grid Demo

Please let me know if you have any questions.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon