Jul 28, 2009 10:46 AM|Riikka Heikniemi|LINK
Thanks for the solution, I was just looking for something like this! Only thing that needs changing (because of the modifications in the final MVC version) is to replace "ViewData[key]" with "ViewData.Eval(key)" so that it works with typed view
data models, too.
Generally, server side controls are not the thing to use in MVC, but in some cases like Charts there are no easy alternatives. As Melvyn Harbour wrote in a comment to
his blog: "You certainly can use ASP.NET server controls, but since you've got no ViewState, many of them won't behave in quite the manner you might naively expect. [...] Of course, you're sacrificing a lot of the benefits of MVC (clean control of HTML),
but I think something like the charting components is a good example of where you might choose to take that hit."
Of course we could set the data values for a server control in CodeBehind or inline (chart examples
here), but I personally prefer the declarative syntax if you've already decided to use a server control.