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

GridDataBoundGrid

Is it true that whatever I can do with the regualar (Essential Grid) can be done using GridDataBoundGrid? That is can use GridDataBoundGrid with RichTextCells and PictureBox cells and also display grid in cells?

Thanks
Sudha

5 Replies

J. J.Nagarajan Syncfusion Team September 3, 2007 11:58 PM UTC

Hi Sudha,

Thank you for your interest in Syncfusion product.

Yes, it is possible to have different celltypes similar to GridControl. To have a custom celltype like picture box cell, you need to handle QueryCellInfo event to set cell type for a specific cell and for column refer to the following code snippet.

>>>>>>
//To Add a Picture box
this.gridDataBoundGrid1.Model.CellModels.Add("ImageAndButton", new PictureBoxCellModel(this.gridDataBoundGrid1.Model));//new ImageAndButtonCellModel(this.gridDataBoundGrid1.Model));
GridStyleInfo style = this.gridDataBoundGrid1.Binder.InternalColumns["Index"].StyleInfo;
style.CellType = "ImageAndButton";

PictureBoxStyleProperties tsp = new PictureBoxStyleProperties(new GridStyleInfo(gridDataBoundGrid1.Binder.InternalColumns["Index"].StyleInfo));
tsp.SizeMode = PictureBoxSizeMode.AutoSize;
tsp.Image = SystemIcons.Information.ToBitmap();
>>>>>>

Regarding the RichTextBox Cell:
You can add RichTextBox cell in a grid by setting the CellType property of the GridStyleInfo object to "RichText". Here is a code snippet that shows this task.
>>>>>
this.gridDataBoundGrid1.Binder.InternalColumns[0].StyleInfo.CellType = "RichText";
>>>>>

To have grid has a dropdown in GridDataBoundGrid, please follow the code snippet below.
>>>>>
this.gridDataBoundGrid1.Binder.InternalColumns[2].StyleInfo.CellType = "GridListControl";
>>>>>

Kindly refer to the attached sample for implementation and let me know if this helps.
http://websamples.syncfusion.com/samples/Grid.Windows/F67852/main.htm

Regards,
Nagaraj


SR Sudharsini Ravikumar September 5, 2007 04:33 PM UTC

Thanks for the sample. The sample shows how to set a column to the specified type. Is it possible to set individual cells of the same column to be of different cell types? I mean can I have picture box cell type, RichText box cell type etc in the same column?

Thanks
Sudha


J. J.Nagarajan Syncfusion Team September 6, 2007 08:49 PM UTC

Hi Sudha,

Thanks for your continued interest in SYncfusion product.

You can add the image and Richtext in a particular cell of the column. You can handle Model.QueryCellInfo event. Please refer to the following code snippet

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.ColIndex == 1 && e.RowIndex == 1)
{
e.Style.CellType = "Image";
e.Style.ImageList = List;
e.Style.ImageIndex = e.RowIndex % 2;
}

if (e.ColIndex == 1 && e.RowIndex == 2)
{
e.Style.CellType = "RichText";
}
}

I have attached the sample for your reference.

http://websamples.syncfusion.com/samples/Grid.Windows/F67852_Sep6/main.htm

Please refer to the sample and let me know if you have any questions.

Regards,
Nagaraj


SR Sudharsini Ravikumar September 6, 2007 09:13 PM UTC

Hi
We recently purchased the product and I'm trying to use the Essntial Grid to display Picture and Rich text in cells. I have some problems with resizng. Please see the attached sample app. When you resize the window the height of the richtext cell does not get changed. Could you please help? This is very important for us.

Thanks
Sudha

InPlaceRichTextCellSample_VB.zip


J. J.Nagarajan Syncfusion Team September 8, 2007 05:39 AM UTC

Hi Sudha,

Please try the modifeid code below in the grid.Model.QueryColWidth event of the grid. This seems to work fine in resizing the grid in accordance to the form resize.

If e.Index > Me.gridControl1.Model.Cols.HeaderCount Then

Dim clientwidth As Integer = Me.gridControl1.ClientRectangle.Width - Me.gridControl1.Model.ColWidths(0)
e.Size = Math.Ceiling(Convert.ToDouble(clientwidth) / Me.gridControl1.Model.ColCount) - 1
e.Handled = True

End If


http://www.syncfusion.com/Support/user/uploads/InPlaceRichTextCellSample_VB_209d4cde.zip

Regards,
Nagaraj

Loader.
Live Chat Icon For mobile
Up arrow icon