开发者

Using DataBinder for casting the whole object in one step

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开发者_如何学Python.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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜