Binding Datasource to an object ?

  • Thread starter Thread starter Sagaert Johan
  • Start date Start date
S

Sagaert Johan

Hi

Instead of binding to a control, can i bind to an non visual object ?

I want to have a string that is the result of adding 2 fields, can i to it
with adding some kind of binding to a class object ?



eg , string fullname = dr["Firstname"] as string + " " + dr["lastname"] as
string ;

now i solve it by binding to 2 invisible controls and then writing string
fullname=TextboxFirstname.Text + " " +Textboxlastname.Text;


J.
 
I'm not exactly sure what you mean, but I'll take stab at it:

You can define one of the columns of your DataTable to be an object type and
then place that object in the data rows for that column. You can then
override the ToString() method of the object to produce whatever string you
want.

Is that what you're asking?

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top