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 in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

71275 Jan 24,2008 04:43 AM Feb 8,2008 05:27 AM Windows Forms 1
loading
Tags: GridControl
Mathieu Gyorffy
Asked On January 24, 2008 04:43 AM

Hi,
I'm using a GridDataBoundGrid (Syncfusion 5.202.0.25).
The DataSource of the grid contains the Parent and the Children DataTables. It also contains a DataRelation between the 2 tables.
The Grid's Binder also contains this DataRelation.

In the grid, I see the following rows:

Parent1
Child1
Child2
Parent2
Child3
Child4
...

For the Parents and Children DataTables, I have 3 columns: Name, Value and Tag (Tag is hidden) + the column for the relation which is also hidden.

Until now, everything's fine.

I 'd like to have different cell types (Text, ReadOnly, ComboBox...) depending on :
- the nature of the row (Parent or Child)
- the data represented by the cell(which can be found in the Tag)

In order to do this, I've implemented the Model_QueryCellInfo event (as in your GDBGMultiHeader example) and I'm trying to set the gridQueryCellInfoEventArgs.Style.CellType.
However, I don't know how to get the DataTable Row corresponding to the cell for which Model_QueryCellInfo is being called.

Could you tell me how to do this or tell me if there is a better way to change the CellType depending on the data bound to it?

Thanks in advance
Mathieu


SubhaSheela R [Syncfusion]
Replied On February 8, 2008 05:27 AM

Hi Mathieu,

Thank you for using Syncfusion products.

1. There is no other possibility to set the cell type of the particular cell in GridDataBoundGrid. You can handle QueryCellInfo event to set cell types to the particular cell in GridDataBoundGrid using its CellType property.
2. You can retrieve the selected row by passing GridBoundDataGrid's DataSource and its DataMember to the BindingContext method of the GridBoundDataGrid and assign it to the CurrencyManager class object. Then typecasting this object to DataRowView object, you can get the selected record.
Below is the code snippet:


CurrencyManager cm = (CurrencyManager)BindingContext[gridDataBoundGrid1.DataSource, gridDataBoundGrid1.DataMember];
DataRowView drv = (DataRowView)cm.Current;
this.label1.Text = "ParentID:" + drv["parentID"].ToString() + "\n EmpID:" + drv["EmpID"].ToString() + "\n EmpName:" + drv["EmpName"].ToString() + "\nQuantity:" + drv["Quantity"].ToString() + "\nPrice:" + drv["Price"].ToString();


Please refer the sample available in the link below and let me know if it helps:

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

Regards,
Subhasheela R




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.

;