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

[Solved] Grouping On Objects Property

2 Answers 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
lmf232s
Top achievements
Rank 1
lmf232s asked on 13 Sep 2010, 08:36 PM
I have a column in my grid that is bound to an object:
columns.Bound(o => o.State).HtmlAttributes(new { style = "text-align:center;" });

Im attempting to group on State Abbreviation:
groups.Add(o => o.State.StateShort).ToString();

On the initial page load the grouping displays correctly and displays records by each state (MO, TX, AL, etc)

The problem occurs when I remove the grouping filter and then drag the state
field back up to the grouping bar. Once I do this and the page reloads the grouping field displays like:
State: System.Data.Entity.DynamicProxies.State_B8F94AA2F3F3F0F878BC3EA5504E749571D766CA8C30DFE41C4BF3CB31EC41C0

Any ideas?

2 Answers, 1 is accepted

Sort by
0
lmf232s
Top achievements
Rank 1
answered on 22 Sep 2010, 05:16 PM
Just bumping this to see if anyone has had this issue or knows of a way to solve it. I have attached a screen shot to give a visiable explination of the issue at hand. The first pic is the page load and you'll notice that it groups by the state and displays the state correctly. The second image was taken after I removed the grouped field and then re-drag the state column to the group by bar. You'll notice that it does indeed group correclty but this time it does not display correctly. It's unable to determine which field from the state object to bind by so it displays the entire object.

Any ideas on how to resolve this?
0
lmf232s
Top achievements
Rank 1
answered on 22 Sep 2010, 08:03 PM
Just wanted to add a little more, hoping someone might see it.

My initial grouping on the grid is set up to group by the States Abbreviation. Here is the grid code
.Groupable(grouping => grouping.Groups(groups =>
{
       groups.Add(o => o.State.StateShort).ToString();
})

And when the page loads the label in the grouping tool bar is 'State Short'.

Now when I remove this grouping (Clicking the x on the label) and then drag the State Column to the grouping tool bar, it displays 'State' as such its trying to group on the entire object and thus I get the display found in the image attached in the above post.

My column in question is this
columns.Bound(o => o.State);
Tags
Grid
Asked by
lmf232s
Top achievements
Rank 1
Answers by
lmf232s
Top achievements
Rank 1
Share this question
or