ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Makefooter in demo return new object for only table fields not working on fields like Chef.FirstName or Country.Name
Title:
B
I
{code}
?
Hi, I was testing the demo solution "SimpleDemoAwe", I wanted to use Makefooter to set some footer counts and summation. in MakeFooter function you returns: return new { Name = pref + " count = " + info.Items.Count(), CountryName = info.Items.Select(o => o.Country.Name).Distinct().Count() + " distinct Country", Date = " max: " + info.Items.Max(o => o.Date).Date.ToShortDateString(), //Price = info.Items.Sum(o => o.Price) }; I'm unable to use Country.Name it gives build error, so below is not working: *_CountryName_ = info.Items.Select(o => o.Country.Name).Distinct().Count() + " distinct Country",* and this gives build error: *_Country.Name_ = info.Items.Select(o => o.Country.Name).Distinct().Count() + " distinct Country",* How to fix this and assign the distinct count to Country.Name Regards
Save Changes
Cancel
Baha' Al Fataftah
asked at 08 Oct 2014
is it compile error ? what is the error message ?
at 08 Oct 2014
Omu
*Compilation Error* _Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access._
at 08 Oct 2014
Baha' Al Fataftah
you get the compile error because of some syntax error in naming the members, but regardless in this version (4) the only way you can set a footer is if your column has a Name without [. ,] (bound to a single first level property) and in the Make Footer you set a value to the property with the same name, so with the code shown above Name and Date will work, CountryName won't
at 08 Oct 2014
Omu
I C, Thanks for clarifying that.
at 08 Oct 2014
Baha' Al Fataftah
now (version 4.5) there's Column.FooterClientFormat, see it being used in the updated demo: http://demo.aspnetawesome.com/GridDemo/Grouping
at 19 Nov 2014
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK