This is a migrated thread and some comments may be shown as answers.

RadGridView. How do I get an effect similar to the demo?

4 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Czeshirecat asked on 22 May 2017, 10:34 AM

Hi. I want to display a gridview almost identical to the way it's displayed in the demo. I've spent hours trying to compare files but I still can't get the same behaviour.

I do have a couple of changes that I want.

There's only 3 columns in the datasource. CreationDate (datetime a record was created), ResultString (a string displaying a pass fail result), and a calculated column Date, which is the field I want to group on, which is just the date portion of CreationDate.

1) I want the grid to be set up grouped on the Date column automatically, as you've done with the City column in the demo. But I don't want the user to see the Grouping bar, or the Date column in the grid as it's only there for grouping purposes.

2) I can't see how the demo app gets the "City" button in the grouping bar. I can't emulate that at all. How is that done please? And can all that be hidden?

3) Another problem is formatting. If I show the Date column, the values in that column format correcty e.g. "01/02/2017", just showing short date with no time. But if I drag the Date column to the group bar then the group dividers show the time element e.g. "01/02/2017 00:00:00".
Trying to fix this I've added a Group Descriptor to the properties for the grid for Group, with format {0~:1d} but it doesn't seem to work (and also keeps disappearing from my Designer file)

Can you help please?

 

4 Answers, 1 is accepted

Sort by
0
Czeshirecat
Top achievements
Rank 2
Iron
Iron
answered on 22 May 2017, 10:37 AM
Sorry, I forgot to say. I want the view of the data grouped already just like it is in the demo, without the user having to do it manually
0
Dimitar
Telerik team
answered on 23 May 2017, 09:21 AM
Hello Claire,

I am not sure which example you are using. Could you please specify that?

1. You can add GroupDesriptors: Setting Groups Programmatically | RadGridView.

2. You can hide the group bar by setting the ShowGroupPanel property.

3. You can use the GroupSummaryEvaluate event:
private void RadGridView1_GroupSummaryEvaluate(object sender, GroupSummaryEvaluationEventArgs e)
{
    if (e.SummaryItem.Name == "Date")
    {
        e.FormatString = String.Format("Group by date: {0}", ((DateTime)e.Value).ToShortDateString());
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Czeshirecat
Top achievements
Rank 2
Iron
Iron
answered on 31 May 2017, 10:44 AM

Hi, it's the Winforms, DemoAppsHub, GridExample, grid view.

At design time, the group by bar already contains a "City" button. I can't see how this has been done. I've studied the code, and the designer.cs file.

0
Dimitar
Telerik team
answered on 31 May 2017, 11:04 AM
Hi Claire,

The group is added at design time. The attached image shows the code for it. The article specified in my previous post describes exactly how you can achieve this.

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Answers by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Dimitar
Telerik team
Share this question
or