views:

21

answers:

1

With ASP.Net 4, is there any way that we can bind web-form controls to entity framework objects?

<asp:TextBox ID="UserName" runat="server" BoundTo="UserName" BindingSource="..."></asp:TextBox>

so just like in MVC I can

 form.UpdateModel(userObj), 
 form.DisplayModel(userObj)

any ideas?

A: 

Hey,

Yes, you can use a DetailsView control with AutoGenerateColumns to true to display an object in line, but this control doesn't use any attributes to set the display name and adjust any other features like MVC does...

Or, set autogeneratecolumns to false and explicitly specify the properties of the object being bound; this control can bind to any object type.

HTH.

Brian