views:

24

answers:

1

Is it possible to do data binding on the fields of an object just like in WPF?

Something like this:

<TextBlock Text="{Binding ElementName=lbColor}" />

just for an asp:TextBox element. What I want is that on submit to have the new values inside the binded object and I don't want to manually read and set the values.

+1  A: 

if you are binding in a template you can use:

<asp:textbox Text="<%#Bind("lbColor")%>" runat="server" />

see: http://support.microsoft.com/kb/307860

Glennular
Unfortunately I'm not binding in a template. Is there any other solution?
Victor Hurdugaci
you can use the FormView a quick databindable control, put your controls into the <ItemTemplate>, set it's datasource to your object and then run databind()
Glennular