I have an asp.net gridview in which I am showing a column of date, the date itself is coming from a sql database table, I have used sorting in that grid and it works perfectly when I click on date column but I want some kind of grouping based on date, like depicted below:
Default gridview look when sorted
21/07/2011
21/07/2011
25/07/2011
25/07/2011
27/07/2011
27/07/2011
What I want is:
21/07/2011
21/07/2011
25/07/2011
25/07/2011
27/07/2011
27/07/2011
I want some kind of separator or blank row that separate groups based on dates, this way data will be more clearly visible. How can I achieve this ?
Thanks
read this article, it shows how you can override Render event to create group header based on your sorting column.
The ListView has grouping like this out of the box.
Related
I have a DevExpress ASPx GridView control and am trying to implement sorting for the grid columns.
The gridView contains has integer values in one column, text in the rest. I also have a column which contains hyperlinks and is added through the code behind during run time.
I am using the Aspxgrid_CustomColumnSort event for sorting the grid.
I can achieve the sorting for the column which contains the integer values and texts successfully, however the same code is not working for the column with hyperlinks.
When I click on the column header the hyperlinks sorts in ascending order,
but when I click the header the second time the grid isnt getting sorted in the descending order, the hyperlinks are sorted in randomn order ( neither ascending nor descending)
And, further clicks on the header do not do anything.
Any advice/suggestion will be greatly appreciated.
Maybe this link will help: http://www.devexpress.com/Support/Center/p/B145444.aspx. In this page, someone had reported an issue using the GridViewDataHyperLinkColumn.
I'm using a Flexicious Ultimate datagrid for visualising some data.
I'm using the built in Filter field for some columns.
This is working fine if I don't use any labelfunction on the provided cell data.
The Flexicious filter data is automatically build from the data in the cells of that specific row. When I use a labelfunction on the cell data the filter values are shown correct, but when I select to show a specific value, the datagrid return 0 records.
Example:
The dataprover.Price = 25
In use a currency formatter so the cell data would be €25
The filter fields of the datagrid show all the different datavalues from all the cells (distinct).
In this case it would be ALL & €25. When I select to only show the fields with price = €25 the datagrid returns 0 records.
I can't seem to find the correct settings to get this fixed.
Is there anyone who can help me with this problem?
Thanks!
Have you tried setting useLabelFunctionForFilterCompare=true?
I am using Devexpress XtraGrid Control, Here I can count the number of rows in footer of grid. but for this I need to set count property of SummeryItem in grid for at least one column. I dont want to do like this.
I want count number of rows in xtraGrid without referring any one column in grid. I just want to show number of rows count. when user will filter that rows, at that time count also need to be changed.
Is there any option to show this number in Group header panel?
I'd use BaseView.RowCount to get the row count and draw it within CustomDrawGroupPanel event.
You can use the customsummarycalculate event to count the number of rows currently shown in the filtered collection and display it in the summary area (generally, I put that text in the summary area of the ID field for the collection I'm using - as I never have a need to put anything else there).
I don't know if this is an update but:
int i = view.SelectedRowsCount;
I am using a Datagrid with several columns of data (call it myDG) and one of these columns is a DateTime bound to a datasource. Its value is dependent on a "job" object completing a job and assigning the date time value. Since this normally takes up to a minute the value is left unassigned at the beginning.
The column's asp.net definition is:
<asp:boundcolumn
DataField="CompletedDate"
HeaderText="Date Completed"
DataFormatString="{0:dd-MMM-yyyy <br> hh:mm:ss tt}" />
So the functionality works fine when the "job" has completed and it sets the time. But before that, while the row is being displayed, it shows as
01-Jan-0001
12:00:00 AM
I am wanting to hide this and determined that the best way would be to mask that particular row and column with a blank, or override the value temporarily. I am having problems doing this and finding a way to access that specific row and column.
It is the [3] column of the datagrid and always in the first row (since new rows are added at the top).
Is there a way to directly access this cell and temporarily 'hide' its contents, or mask them? Ideally it would be great if there was a way to blank out all rows that had a value equal to this in their column, but a way to manipulate the specific cell would work as well.
-thanks in advance!
I would probably hook OnItemDataBound, check the value, and replace/reformat if required.
I asked a similar question about hiding columns here.
I had to use the RowCreated event to hide certain columns from the user (PK columns) and this may help you out as well (especially with hiding databound columns).
I have done similar things in the past and here is what I have done.
Bind the data to a column that is not visible at all. Add a visible column for the data you wish to display. At the time you populate your grid, loop through the records and for any that have a value that isn't 01-Jan-0001 12:00:00 AM, set your visible row to that value. If it does equal 01-Jan-0001 12:00:00 AM, then set the value of your visible row to an empty string or some value of your choice. (You could even set the text color to the same as the background color so it wouldn't appear to the user)
I have a situation where I'm populating a gridview with a bound data source, and want two additional rows at the very bottom; one to show the sum of values in the columns and one to show the average of values in the columns. I can quite easily calculate these values by aggregating information taken from the rowDataBound event, but don't know how to go about manually adding the additional two rows to the gridview. Any help much appreciated.
You can use the Footer just like you use Headers in gridview. Another solution is use a query in such way:
query 1 : your original query
UNION
query 2 : your query which contains sum
(This applies only if you don't apply paging to your grid)
If it's a single row of information you can use summary footer. See Displaying Summary Information in the GridView's Footer.
(source: asp.net)
If you want two additional rows, you can stuff rows into an IList. At the business logic layer, you can add more rows to the list returned by DAL.