Lets say I have an object
class Person {
public string Name { get; set; }
public int Age { get; set; }
}
And that object is retrieved from a Factory (ie Can't use SQLDataSource or anything like that)
Person person = PersonFactory.GetPerson();
How can I two-way DataBind the two properties to Textboxes on a web form? I looked into FormView, but that doesn't seem to fit my needs as I am not iterating over a collection of objects. And when I tried to use it, I don't seem to be getting the posted values in the Person object in the FormUpdated event. And I am binding like this
Markup
<asp:Textbox Text=<%# Bind("Name") %> />
Code behind
FormView1.DataSource = new List() { person };
FormView1.DataBind();
I feel like I am missing something really obvious. Should I be using a FormView? It doesn't seem like it a proper fit for simple data binding, but the <#% Bind %> method must be in some type of container -- is there a more suitable object?