Saturday, March 24, 2012

setting textbox from dataview in code behind

If in my aspx page I set a textbox text value like this:

<asp:textbox id=Title runat="server" Text='<%# DataBinder.Eval(PeopleDataView, "[0].Person_Title") %>'
how would I set it in the code behind using the same row and column from the same dataview ( in C#)
e.g.
Title.Text = ????;

Thanks
JohnHello,

if you want to bind data values to a textbox at runtime you can use the data-binding event that is raised by the control e.g. a textbox.
Take a look @.Data Binding Single-Value Web Server Controls at Run Time on MSDN...

HTH,
I haven't done this before but would start looking at something like this....


Title.DataBindings.Add (New Binding("Text", ds, "customers.custName"))

0 comments:

Post a Comment