I have a hierarchical Grid,
I want to have Combo Box celltype in Child rows, i tried added these lines of code is not working.
Grid1.gridbinder.internalcolumns.item(0).Celltype="ComboBox"
Grid1.gridbinder.internalcolumns.item(0).datasource= dstest
Please help me where i am missing
Regards
Rajaraman
AD
Administrator
Syncfusion Team
February 21, 2003 12:49 PM UTC
You also need to specify ValueMember and DisplayMember.
Example:
[VB]
Dim supplierIDStyle As GridStyleInfo = hlCategory_Products.InternalColumns("SupplierID").StyleInfo
supplierIDStyle.CellType = "GridListControl"
supplierIDStyle.DataSource = ds.Tables("Suppliers")
supplierIDStyle.DisplayMember = "CompanyName"
supplierIDStyle.ValueMember = "SupplierID"
supplierIDStyle.HorizontalAlignment = GridHorizontalAlignment.Left
[C#]
GridStyleInfo supplierIDStyle = hlCategory_Products.InternalColumns["SupplierID"].StyleInfo;
supplierIDStyle.CellType = "GridListControl";
supplierIDStyle.DataSource = ds.Tables["Suppliers"];
supplierIDStyle.DisplayMember = "CompanyName";
supplierIDStyle.ValueMember = "SupplierID";
supplierIDStyle.HorizontalAlignment = GridHorizontalAlignment.Left;
Stefan
RA
Rajaraman
February 22, 2003 05:46 AM UTC
i want to write generic procedure, i may not know this level information, i know it is easy to do for master rows from Grid itself, please refer my code again, i dont this hlCategory_Products objects at my Form.
i know only Grid. It is working if we work with
hierarchy level object, but i need another way.
Thanks
Rajaraman
> You also need to specify ValueMember and DisplayMember.
>
> Example:
>
> [VB]
> Dim supplierIDStyle As GridStyleInfo = hlCategory_Products.InternalColumns("SupplierID").StyleInfo
> supplierIDStyle.CellType = "GridListControl"
> supplierIDStyle.DataSource = ds.Tables("Suppliers")
> supplierIDStyle.DisplayMember = "CompanyName"
> supplierIDStyle.ValueMember = "SupplierID"
> supplierIDStyle.HorizontalAlignment = GridHorizontalAlignment.Left
>
> [C#]
> GridStyleInfo supplierIDStyle = hlCategory_Products.InternalColumns["SupplierID"].StyleInfo;
> supplierIDStyle.CellType = "GridListControl";
> supplierIDStyle.DataSource = ds.Tables["Suppliers"];
> supplierIDStyle.DisplayMember = "CompanyName";
> supplierIDStyle.ValueMember = "SupplierID";
> supplierIDStyle.HorizontalAlignment = GridHorizontalAlignment.Left;
>
>
>
> Stefan
AD
Administrator
Syncfusion Team
February 22, 2003 07:56 AM UTC
Can you get the hierarchy level using GridDataBoundGrid1.Binder.GetHierarchyLevel?
//set second column in the first child to checkbox
GridHierarchyLevel level = this.gridDataBoundGrid1.Binder.GetHierarchyLevel(1); //first child
GridStyleInfo style = level.GridBoundColumns[1].StyleInfo;//second column
style.CellType = "ComboBox";
style.ValueMember = "Col2"; //name of value member column
style.DisplayMember = "Col1"; //name of value member column
style.DataSource = dt; //datatable with at least columns named Col1 and Col2
style.ShowButtons = GridShowButtons.Show;
this.gridDataBoundGrid1.Refresh();
RA
Rajaraman
February 22, 2003 08:37 AM UTC
Hi
Are you there? Can you come to some
chat window either MSN/Yahoo
Please reply me
Regards
Rajaraman
> Can you get the hierarchy level using GridDataBoundGrid1.Binder.GetHierarchyLevel?
>
>
> //set second column in the first child to checkbox
> GridHierarchyLevel level = this.gridDataBoundGrid1.Binder.GetHierarchyLevel(1); //first child
> GridStyleInfo style = level.GridBoundColumns[1].StyleInfo;//second column
> style.CellType = "ComboBox";
> style.ValueMember = "Col2"; //name of value member column
> style.DisplayMember = "Col1"; //name of value member column
> style.DataSource = dt; //datatable with at least columns named Col1 and Col2
> style.ShowButtons = GridShowButtons.Show;
>
> this.gridDataBoundGrid1.Refresh();
>
>
RA
Rajaraman
February 22, 2003 08:45 AM UTC
Hi
I want to have a Unbound Column in Child Level rows? How to do it?
I want to add rows to Child level? after enabling
EnableAddnew, i can press enter go for creating another row(parent level), it is working, but i could not click the + button and add child rows
Where I am missing?
Regards
Rajaraman
AD
Administrator
Syncfusion Team
February 22, 2003 03:03 PM UTC
You would have to add a GridBoundColumn with some unique MappingName to the child level. Take a look at the Grid/Samples/DataBound/Hierarchical/CustomersVirt sample. In that sample, the parent and child share the same GridBoundColumn layout, but you could add a particular unbound column to that child collection, that would not be in the parent's collection.
Adding new rows to a child level through the grid is not supported in the current release. This support will be in the upcoming 2.0 release. For now, you would have to add the new row directly to the datasource(through maybe a button or menu item). Then the grid should automatically display the added row.
RA
Rajaraman
February 24, 2003 12:13 PM UTC
Thanks Clay
Regs
Rajaraman