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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

drop down grids

Thread ID:





17590 Aug 12,2004 03:27 PM UTC Aug 13,2004 03:10 PM UTC WinForms 13
Tags: GridControl
Administrator [Syncfusion]
Asked On August 12, 2004 03:27 PM UTC

Hi, is there a demo somewhere that lets you click on headers to sort and resize columns for grid list controls dropped down in this case from a combobox? tia

Administrator [Syncfusion]
Replied On August 12, 2004 04:20 PM UTC

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.

Administrator [Syncfusion]
Replied On August 12, 2004 09:00 PM UTC

hi, 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; } else d.Sort = sortName; //g.Grid.Model[0, col].Tag = sortDir; args.Cancel = true; } }

Administrator [Syncfusion]
Replied On August 12, 2004 09:38 PM UTC

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.

Administrator [Syncfusion]
Replied On August 13, 2004 10:03 AM UTC

Hi, I tried e.Style.Tag = ListSortDirection.Ascending but it doesn''t do anything? tia

Administrator [Syncfusion]
Replied On August 13, 2004 10:18 AM UTC

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.

Administrator [Syncfusion]
Replied On August 13, 2004 11:30 AM UTC

hi Clay, ya, this is about the icon. we''re getting closer, one little thing left... how do i get the datasource from here? thank you 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; else e.Style.Tag = ListSortDirection.Ascending; } } }

Administrator [Syncfusion]
Replied On August 13, 2004 11:40 AM UTC

correction: if (d.Sort.ToUpper().IndexOf(e.Style.Text.ToUpper()) != -1) maybe

Administrator [Syncfusion]
Replied On August 13, 2004 11:48 AM UTC

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.

Administrator [Syncfusion]
Replied On August 13, 2004 11:55 AM UTC

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.

Administrator [Syncfusion]
Replied On August 13, 2004 01:15 PM UTC

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

Administrator [Syncfusion]
Replied On August 13, 2004 02:04 PM UTC

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?

Administrator [Syncfusion]
Replied On August 13, 2004 02:38 PM UTC

Yes, you are right. You can try getting gridModel.ActiveGridView and cast it to a GridControl.

Administrator [Syncfusion]
Replied On August 13, 2004 03:10 PM UTC

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!


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon