1

Is it possible to cast the whole object using DataBinder.Eval() instead of casting it by property. e.g.:

// instead of this
var p = new Person();
p.FirstName = Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "FirstName"));
p.Age = Convert.ToInt32(DataBinder.Eval(Container.DataItem, "Age"));
...

// use something like this in one step
var p = DataBinder.Eval<Person>(Container.DataItem);
sam
  • 1,211
  • 2
  • 13
  • 15
  • why on earth would u use such a code in asp.net mvc3 when it provides out of the box modelbinding. have a look at http://weblogs.asp.net/nmarun/archive/2010/02/25/asp-net-mvc-model-binding.aspx – Muhammad Adeel Zahid Jul 08 '11 at 08:00
  • @Muhammad Adeel Zahid I use it within view to process the value that is provided by DevExpress control. I _have to_ deal with `Container.DataItem`. – sam Jul 08 '11 at 08:15

0 Answers0