ADAdministrator Syncfusion Team August 12, 2004 11:20 AM
If you want to size and sort the columns in a dropdown cell, then it would probably be simpler to drop a grid as in the grid/sample/indepth/dropdowngrid samples. You could change teh type of the dropdowngrid to GriddataBoundGrid, and set its DataSource, DisplayMember and ValueMember in CurrentCellShowingDropdown.
ADAdministrator Syncfusion Team August 12, 2004 04:00 PM
I put the following together, any idea how to get the ListSortDirection into the tag? i prefer the grid list control because it has some extra features like the highlighting, positioning, etc.
private void comboBoxBase2_DropDownCloseOnClick(object sender, Syncfusion.Windows.Forms.Tools.MouseClickCancelEventArgs args)
int row, col;
GridListControl g = ((ComboBoxBase)sender).ListControl as GridListControl;
g.Grid.PointToRowCol(g.PointToClient(args.MouseClickPoint), out row, out col);
if (row == 0)
DataView d = g.DataSource as DataView;
String sortName = d.Table.Columns[col - 1].ColumnName;
ListSortDirection sortDir = ListSortDirection.Ascending;
if (d.Sort == sortName)
d.Sort = sortName + " DESC";
sortDir = ListSortDirection.Descending;
d.Sort = sortName;
//g.Grid.Model[0, col].Tag = sortDir;
args.Cancel = true;
ADAdministrator Syncfusion Team August 12, 2004 04:38 PM
To get at the header cell in that embedded Grid, I think you would have to subscribe to the g.Grid.Model.QueryCellInfo event. There when e.RowIndex = 0 and e.ColIndex > 0, you can then set the e.Style properties you need to set.
ADAdministrator Syncfusion Team August 13, 2004 05:03 AM
I tried e.Style.Tag = ListSortDirection.Ascending but it doesn''t do anything?
ADAdministrator Syncfusion Team August 13, 2004 05:18 AM
This code should be putting the value into the style.Tag object ok.
Exactly what do you expect to see when you do this?
Are you trying to get the sort icon to appear? If so, you would have to register the ColumnHeaderCell celltype with the grid as in the grid\samples\quickstart\gridcontrolsort sample. Then, in addition to setting the style.Tag in QueryCellInfo, you would also need to set the style.CellType to "ColumnHeaderCell".
If you post a sample showing what you are trying to do, maybe we can tweak it here to get it working.
ADAdministrator Syncfusion Team August 13, 2004 06:30 AM
ya, this is about the icon. we''re getting closer, one little thing left...
how do i get the datasource from here?
private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
if (e.ColIndex > 0 && e.RowIndex == 0)
// doesnt work --> DataView d = e.Style.DataSource as DataView;
String sortName = d.Table.Columns[e.ColIndex - 1].ColumnName;
if (sortName.IndexOf(e.Style.Text) != -1)
e.Style.CellType = "ColumnHeaderCell";
if (d.Sort.IndexOf(" DESC") != -1)
e.Style.Tag = ListSortDirection.Descending;
e.Style.Tag = ListSortDirection.Ascending;
ADAdministrator Syncfusion Team August 13, 2004 06:40 AM
if (d.Sort.ToUpper().IndexOf(e.Style.Text.ToUpper()) != -1)
ADAdministrator Syncfusion Team August 13, 2004 06:48 AM
I think is the DataSource of the GridListControl that you want to get at this point correct?
This should not vary depending upon the actual gridListControl1.Grid cell being drawn. So, do you have a reference to the GridListControl at this point? If so, you could try using gridListControl1.DataSource.
ADAdministrator Syncfusion Team August 13, 2004 06:55 AM
yes i have that but i was trying to make it generic so that i dont have to repeat this code 50 times. i mean just put it in a public static.
ADAdministrator Syncfusion Team August 13, 2004 08:15 AM
If it is a single DataSource, you can try setting it to
gridListControl1.Grid.TableStyle.DataSource = theDataSource;
Then in QUeryCellInfo, you can try to get it from
(sender as GridControlBase).TableStyle.DataSource
ADAdministrator Syncfusion Team August 13, 2004 09:04 AM
isn''t sender in Model_QueryCellInfo a GridModel? besides GridControlBase doesn''t have a TableStyle.
one thing i could do if there''s no choice is to pass the gridlist to the public static like App.utils.ModelQueryCellInfo(ref this.gridListControl2, ref e);
so is that the only option?
ADAdministrator Syncfusion Team August 13, 2004 09:38 AM
Yes, you are right.
You can try getting gridModel.ActiveGridView and cast it to a GridControl.
ADAdministrator Syncfusion Team August 13, 2004 10:10 AM
DataView d = (((GridModel)sender).ActiveGridView as GridControl).TableStyle.DataSource as DataView
worked swell, thanks Dr.
seriously folks, buy this software, you wont find better support!