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.

Split Columns

Thread ID:

Created:

Updated:

Platform:

Replies:

56622 Feb 17,2007 01:29 AM Jun 11,2007 06:33 PM Windows Forms 16
loading
Tags: GridControl
Tannearu Hazarathaiah Gupta
Asked On February 17, 2007 01:29 AM

HI,
We are using Syncfusion Essential Studio 4.4.0.55 (Grid Data Bound Grid).

We have a requirement to display part of the data in the grid as split coulmns. I have attached a sample sheet showing the exact requirement of how the data has to be displayed in the grid.

To bind the data we are using custom entities rather then data sets.

Please let me know how it can be achived sample code would help.

Thanks
Hazrat

Sample109.zip

Administrator [Syncfusion]
Replied On February 19, 2007 02:52 PM

Hi Tannearu,

One way to do this would be to derive a custom cell type like the ones( \4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes\SliderCells). It requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell. Then to use your custom cell type in a grid, you need to register this celltype with the grid as shown in this sample.s\Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes.

Here is a minimal sample that show you "How to add the multiple textbox celltype in a cell"
TwoTextBoxCell.zip

Best regards,
Haneef

Tannearu Hazarathaiah Gupta
Replied On February 20, 2007 06:36 AM

Hi Haneef,
Thanks for your reply.

We are using Syncfusion Essential Studio 4.4.0.55 (Grid Data Bound Grid).

I am unable to find Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes
SliderCells



Reagards
Tannearu

>Hi Tannearu,

One way to do this would be to derive a custom cell type like the ones( \4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes\SliderCells). It requires a model class and a renderer class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell. Then to use your custom cell type in a grid, you need to register this celltype with the grid as shown in this sample.s\Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes.

Here is a minimal sample that show you "How to add the multiple textbox celltype in a cell"
TwoTextBoxCell.zip

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 20, 2007 10:58 AM

Hi Tannearu,

Please use the below path.
[you installation path]\Syncfusion\Essential Studio\4.4.0.55\windows\Grid.Windows\Samples\CustomCellTypes\SliderCells

or

The Browser Sample can be accessed from Start Menu >> Programs >> Syncfusion >> Essential Suite 4.4.0.55 >> Windows Forms >> Browser Sample. And then you can get the SilderCells sample from Grid.Grouping >>>CustomCellTypes node

Best regards,
Haneef

Aditi Pisal
Replied On February 22, 2007 02:29 AM

Hi Haneef,

This is in context to your previous reply for using the CustomCell exe.
I have syncfusion 4.4.0.55 but when I click on "Browse Samples" I get error of "SampleBroweser.exe" not found.
Pls suggest an alternative for the above.
Kindly consider we are using "GridGroupingControl" and require to split the data into 2 rows for a particular column.
Pls reply as soon as possible.



Sample1091.zip

Administrator [Syncfusion]
Replied On February 22, 2007 03:46 PM

Hi Aditi,

The attached sample shows you "How to split the data into two rows for a cell in a GroupingGrid?". It also implements the GridGenericControlCellModel and GridGenericControlCellRenderer for creating a custom cell type ina grid. Please refer to the attached sample and let me know if this helps.

Sample : SplitDataCell.zip

Best regards,
Haneef

Aditi Pisal
Replied On February 23, 2007 01:47 AM

Hi Haneef,
Thanks for the sample.
Can you pls suggest how to bind this custom control with the Entity collection instead of a dataset and hard coded values.
Also how to capture the changed text from these custom control textboxes.

Can we use the QueryValue() event and the SaveValue() event in this case.
Pls reply with sample example.




Tod Golding
Replied On May 29, 2007 01:14 PM

I am evaluating your control and this sample (SplitDataCell.zip) is at the heart of what I'm struggling with. When I found it, I thought I'd be all set. However, the sample code you have provided demonstrates the same issue I'm facing (actually two issues I'm facing)

1) When you edit enter data into your custom cell, the values are not retained when you leave the cell (in fact, the data you initialize the cells with is also not shown)

2) I want to bind my custom cell type to my own entity object (without implementing IConvertible). Is that possible with this approach? Should I just put my data in the extended style properties and set/get it that way?

I really love your control, but this one area has me concerned (since custom cell types are big part of my solution). Any chance you can tweak this example to make it work (and have it support "add new")?

>Hi Aditi,

The attached sample shows you "How to split the data into two rows for a cell in a GroupingGrid?". It also implements the GridGenericControlCellModel and GridGenericControlCellRenderer for creating a custom cell type ina grid. Please refer to the attached sample and let me know if this helps.

Sample : SplitDataCell.zip

Best regards,
Haneef

haneefm [Syncfusion]
Replied On May 29, 2007 05:39 PM

Hi Tod,

Here is a minimal sample that shows you "How to bind custom celltypes in a GroupingGrid?". It also uses the IBindinglist as datasource. Please try the sample and let me know if this helps.

Sample :ModifiedSplitDataCell.zip

Best regards,
Haneef

Tod Golding
Replied On May 30, 2007 03:21 PM

Thanks for you help. I've made more progress but I still can't get passed the one fundamental problem that landed me here. The list of objects I'm binding two has properties that are my own custom objects. When I edit the cell value for the cells that are bound to these custom types, the grid tells me I must implement ICovertible for the type that's bound to that cell.

I noticed your example has a Customer object and doesn't complain when leaving the cell so I'm not sure why yours would work and mine would. My data source is my own IList collection and the objects in my collection have custom objects as properties. I am not implement IBindingList or many of the interfaces you are in your DataCollection, but I assume those aren't required.

So, the question is: how do I preven the cell from requiring "IConvertible"? If I'm binding to a datasource of IMyList and "MyObject" has a "MyCustomObjectProperty" I want to be able to bind a column to "MyCustomObjectProperty" without implementing any other special interfaces. Is that possible? If not, is there some other way to get my cell to stop generting the "IConvertible" error message?

I'm so close, but I can't get over the last hurdle. Your help is greatly appreciated.


>Hi Tod,

Here is a minimal sample that shows you "How to bind custom celltypes in a GroupingGrid?". It also uses the IBindinglist as datasource. Please try the sample and let me know if this helps.

Sample :ModifiedSplitDataCell.zip

Best regards,
Haneef

haneefm [Syncfusion]
Replied On May 30, 2007 07:28 PM

Hi Tod,

Issue 1: Storing the values.
You need to override the OnSaveChanges method in your custom cell renderer and save the value your selfy. Please refer these and let me know if this helps.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=54409
CustomBindObject Documentation

Issue 2: Catches the exception.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
If you wan to cancel the exception and you need to handle the Table.ExceptionRaised event and set e.Cancel to true. Here is a code snippet

ggc.Table.ExceptionRaised += new Syncfusion.Grouping.ExceptionRaisedEventHandler(Table_ExceptionRaised);
void Table_ExceptionRaised(object sender, Syncfusion.Grouping.ExceptionRaisedEventArgs e)
{
e.Cancel = true;
}

Also refer to the below forum thread that shows you "How to customize the error-icon in a cell?".
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=55049

Best regards,
Haneef

Tod Golding
Replied On May 30, 2007 11:22 PM

I'm sorry to be such a pest. I realize I posted about 15 varieties of the same question. I had hoped the context of the prior threads would help clarify the problem. I'll consolidate here since I still don't think we're in sync.

Question #1
===========
From you response, I'm assuming that I do *not* have to implement IConvertible to get this to work, right?

Question #2
============
I have implemented OnSave() as you describe here following your example. I still get the error that requires implementation of IConvertible. Setting my custom type into the CellValue doesn't seem to resolve the issue. Is is supposed to?

Question #3
===========
I believe that binding to interfaces (instead of objects) is at the root of my IConvertible issue. I bound one of your out-of-the-box cells (a combo box cell with my custom objects) to a column of a custom type. At first, I was using an interface for my type (IMyCustomObject). That returned an IConvertible error. I changed that same bound column to use the concrete object (MyCustomObject) *instead of the interface* and the binding error went away. This would suggest that interfaces cannot be used for binding. I wondered, in fact, if your binding implemenation counted on ToString() and the other core "object" methods that would not be available when binding to an interface. So, this make me wonder (given question #2 above) if my binding problem for my custom cell type (which is using an interface) is also being impacted by the same problem. Can you verify that binding to a custom property *that is an interface* works?

Question #4
===========
Do I really need separate "draw" and "edit" cells to hold the representation of my custom cell type? I could see that being useful if they were rendered differently, but they're not. However, all of your examples use separate "draw" and "edit" data members. Can you explain why these are needed?




>Hi Tod,

Issue 1: Storing the values.
You need to override the OnSaveChanges method in your custom cell renderer and save the value your selfy. Please refer these and let me know if this helps.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=54409
CustomBindObject Documentation

Issue 2: Catches the exception.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
If you wan to cancel the exception and you need to handle the Table.ExceptionRaised event and set e.Cancel to true. Here is a code snippet

ggc.Table.ExceptionRaised += new Syncfusion.Grouping.ExceptionRaisedEventHandler(Table_ExceptionRaised);
void Table_ExceptionRaised(object sender, Syncfusion.Grouping.ExceptionRaisedEventArgs e)
{
e.Cancel = true;
}

Also refer to the below forum thread that shows you "How to customize the error-icon in a cell?".
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=55049

Best regards,
Haneef

haneefm [Syncfusion]
Replied On May 31, 2007 07:57 PM

Hi Tod,

Thank you for your crystallize explanation.

Question #1
===========
From you response, I'm assuming that I do *not* have to implement IConvertible to get this to work, right?
>>>>>>>>>>>>>>>>>
Yes, You no need to implement the IConvertible interface to work-around this problem. But you need to override the OnSaveChanges method. The attached sample implements the Activator class in the OnSaveChanges override method .Please refer the attached sample and let me know if this helps.

Question #2 and Question #3:
============
I have implemented OnSave() as you describe here following your example. I still get the error that requires implementation of IConvertible. Setting my custom type into the CellValue doesn't seem to resolve the issue. Is is supposed to?
>>>>>>>>>>>>>>>>>
You can use the Activator.CreateInstance method to create new instance of the required base class in OnSaveChanges method. Here is a code snippet that show this task.

protected override bool OnSaveChanges()
{
Type type = this.Grid.Model[this.RowIndex,this.ColIndex].CellValue.GetType();
Type ctype = this.ControlValue.GetType();
if (type == ctype)
return base.OnSaveChanges();
else
{
object objBaseForClass = Activator.CreateInstance(type);
foreach (PropertyInfo propBaseInfo in type.GetProperties())
{
foreach (PropertyInfo propChildInfo in ctype.GetProperties())
{
if (propBaseInfo.Name == propChildInfo.Name)
{
object objPropertyValue = propChildInfo.GetValue(this.ControlValue, null);
if (propBaseInfo.GetSetMethod() != null)
{
propBaseInfo.SetValue(objBaseForClass, objPropertyValue, null);
break;
}
}
}
}
this.Grid.Model[this.RowIndex, this.ColIndex].CellValue = objBaseForClass;
}
return true;
}

Question 4:
============
Do I really need separate "draw" and "edit" cells to hold the representation of my custom cell type? I could see that being useful if they were rendered differently, but they're not. However, all of your examples use separate "draw" and "edit" data members. Can you explain why these are needed?
>>>>>>>>>>>>>
Yes, you will need to have two controls(edit and draw). one for drawing the cell when it is inactive and shared among cells. The other when it is in edit mode.The attached sample have two controls and in the OnDraw method they distinguish between active and inactivate state of the cell.

Please refer to the attached sample for implementation.
http://websamples.syncfusion.com/samples/Grid.Windows/F56622/main.htm

Best regards,
Haneef

Tod Golding
Replied On June 6, 2007 05:09 PM

I'm still struggling with data binding issues and my custom cell type. Your example helped, but it didn't really address the problem I was describing. I'm trying to bind my custom cell type to an object that has a *list* as one its properties. So, my binding object is:

public class MyBindableObject
{
...
...
public IList CustomObjectList
{
...
}
}

And, in the code, I bind a collection of MyBindableObject to my GGC:

...
List myDS = new Listgrid.DataSource = myDs
...

Binding my custom cell type to the CustomObjectList above generates the "Must impement IConvertible" error (event when I override allthe methods you suggest).

I'm uploading a revised version of your sample that demonstrates the problem. I changed your "Data" class to have a customer property to an IList. Now, when you try to leave the cell you get the "Must implement IConvertible" error.

I'm nearing the end of my 30-day evaluation window and I'm still worried that I'm not going to get these issues resolved prior to the end of my evaluation period. Maybe you'll come up with something that gets me passed this. You help would be greatly apprecited.

The example is attached.




>Hi Tod,

Thank you for your crystallize explanation.

Question #1
===========
From you response, I'm assuming that I do *not* have to implement IConvertible to get this to work, right?
>>>>>>>>>>>>>>>>>
Yes, You no need to implement the IConvertible interface to work-around this problem. But you need to override the OnSaveChanges method. The attached sample implements the Activator class in the OnSaveChanges override method .Please refer the attached sample and let me know if this helps.

Question #2 and Question #3:
============
I have implemented OnSave() as you describe here following your example. I still get the error that requires implementation of IConvertible. Setting my custom type into the CellValue doesn't seem to resolve the issue. Is is supposed to?
>>>>>>>>>>>>>>>>>
You can use the Activator.CreateInstance method to create new instance of the required base class in OnSaveChanges method. Here is a code snippet that show this task.

protected override bool OnSaveChanges()
{
Type type = this.Grid.Model[this.RowIndex,this.ColIndex].CellValue.GetType();
Type ctype = this.ControlValue.GetType();
if (type == ctype)
return base.OnSaveChanges();
else
{
object objBaseForClass = Activator.CreateInstance(type);
foreach (PropertyInfo propBaseInfo in type.GetProperties())
{
foreach (PropertyInfo propChildInfo in ctype.GetProperties())
{
if (propBaseInfo.Name == propChildInfo.Name)
{
object objPropertyValue = propChildInfo.GetValue(this.ControlValue, null);
if (propBaseInfo.GetSetMethod() != null)
{
propBaseInfo.SetValue(objBaseForClass, objPropertyValue, null);
break;
}
}
}
}
this.Grid.Model[this.RowIndex, this.ColIndex].CellValue = objBaseForClass;
}
return true;
}

Question 4:
============
Do I really need separate "draw" and "edit" cells to hold the representation of my custom cell type? I could see that being useful if they were rendered differently, but they're not. However, all of your examples use separate "draw" and "edit" data members. Can you explain why these are needed?
>>>>>>>>>>>>>
Yes, you will need to have two controls(edit and draw). one for drawing the cell when it is inactive and shared among cells. The other when it is in edit mode.The attached sample have two controls and in the OnDraw method they distinguish between active and inactivate state of the cell.

Please refer to the attached sample for implementation.
http://websamples.syncfusion.com/samples/Grid.Windows/F56622/main.htm

Best regards,
Haneef

TodTwoCell.zip

haneefm [Syncfusion]
Replied On June 6, 2007 07:17 PM

Hi Tod,

I couldn't see MyBindableObject class in your sample. So, I have modified your attached sample to bind IList to the custom celltype. I have tested the modified sample to reproduce this problem, but i could not get the problem. I recommend modifying the attached sample or any of our browser sample to reproduce the problem. This helps us to realize a better solution at the earliest.

Sample :TodTwoCell.zip

Best regards,
Haneef

Tod Golding
Replied On June 7, 2007 02:21 AM

First, I think we're experiencing some communication difficulties. Here's where we stand:

Point 1: The example I gave in my prior message referencing MyBindableObject was just an example of the scenario. It was not referencing any code or classes from the example. If you look at the original example I provided, I had already changed the "Data" class from your example to make the Customer property an IList.

Point 2: The original example I provided *and* this modified example that you returned both demonstrate the issue I'm disccusing. While the custom cell appears to work when you first bring up the grid, it fails when you enter data for the cell and navigate away. Here's the steps to reproduce the problem:

1) Run the latest example you created

2) Enter data for the custom cell

3) Click in the cell to the right of the custom cell.

4) The system shows the "Must support IConvertible" error.

NOTE: It's easier to see this if you turn off the red background for the custom cell.



>Hi Tod,

I couldn't see MyBindableObject class in your sample. So, I have modified your attached sample to bind IList to the custom celltype. I have tested the modified sample to reproduce this problem, but i could not get the problem. I recommend modifying the attached sample or any of our browser sample to reproduce the problem. This helps us to realize a better solution at the earliest.

Sample :TodTwoCell.zip

Best regards,
Haneef

haneefm [Syncfusion]
Replied On June 11, 2007 06:33 PM

Hi Tod,

Please follow the below forum thread for more details.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=62162

Best regards,
Haneef

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.

;