PC Review


Reply
Thread Tools Rate Thread

Data binding to an object

 
 
Simon Verona
Guest
Posts: n/a
 
      5th Jul 2006
I don't know if I'm missing something... but.. is it possible to databind a
text box to a read/write property of an object at design time?

I see lots of examples to binding to a dataadapter etc, but if I have a
class which represents a business object can I bind directly to the
properties of the class?

Regards
Simon

--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011


 
Reply With Quote
 
 
 
 
Steven Nagy
Guest
Posts: n/a
 
      6th Jul 2006
Yes but only in VS2005. Older versions I don't think its possible...
There's new object data providers in 2005 although I haven't actually
started using 2005 yet so not sure how, where, etc.

Simon Verona wrote:
> I don't know if I'm missing something... but.. is it possible to databind a
> text box to a read/write property of an object at design time?


 
Reply With Quote
 
Simon Verona
Guest
Posts: n/a
 
      6th Jul 2006
Ok thanks.. I'm still on VS2003.. It seems like an interesting omission.

As an aside, if I was to try and implement this by inheriting the textbox
class (and perhaps some of the others) and have two additional properties
called "object name" and "property name", could I then access the property
through reflection?

Would there be a performance penalty to pay to do this?

Anybody give me a head start in terms of coding... ?

Thanks in advance
Simon
--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011

"Steven Nagy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes but only in VS2005. Older versions I don't think its possible...
> There's new object data providers in 2005 although I haven't actually
> started using 2005 yet so not sure how, where, etc.
>
> Simon Verona wrote:
>> I don't know if I'm missing something... but.. is it possible to databind
>> a
>> text box to a read/write property of an object at design time?

>



 
Reply With Quote
 
Steven Nagy
Guest
Posts: n/a
 
      7th Jul 2006
That would work. I wouldn't be able to comment on the performance of
reflection. I use it but have never clocked it. Wouldn't be too bad I
suppose because you aren't talking about massive amounts of objects and
form components right? Check out the System.Type class and all its
methods for getting lists of fields and methods and so on to get
started with reflection.

But there might be an easier way.

Perhaps you only need your object to implement an interface to
databind. I haven't investigated this specifically, but what is the
distinct attributes of the data table and data row that allow them to
be data bound?
Could your object inherit from these instead? Or is changing the object
not possible?

I assume you have checked out the BindingManager and all its uses?

Steven

 
Reply With Quote
 
Simon Verona
Guest
Posts: n/a
 
      7th Jul 2006
Don't assume anything!!

I've not checked out anything yet.

I'm looking for the longer term... At the moment, some of my business logic
is exposed in my user interface, mainly because because I need to bind to
the raw data.

I want to be able to remove all the business logic into a seperate set of
classes, and then bind to the various properties instead - this will allow
me to neaten my code up and remove lots of the business logic out of my UI
(I've already done some of this by writing classes that partially handle the
logic).

I'm planning to migrate to VS2005 towards the end of the year, so I may just
wait till then before I do this.

Regards
Simon

--
================================
Simon Verona
Dealer Management Service Ltd
Stewart House
Centurion Business Park
Julian Way
Sheffield
S9 1GD

Tel: 0870 080 2300
Fax: 0870 735 0011

"Steven Nagy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> That would work. I wouldn't be able to comment on the performance of
> reflection. I use it but have never clocked it. Wouldn't be too bad I
> suppose because you aren't talking about massive amounts of objects and
> form components right? Check out the System.Type class and all its
> methods for getting lists of fields and methods and so on to get
> started with reflection.
>
> But there might be an easier way.
>
> Perhaps you only need your object to implement an interface to
> databind. I haven't investigated this specifically, but what is the
> distinct attributes of the data table and data row that allow them to
> be data bound?
> Could your object inherit from these instead? Or is changing the object
> not possible?
>
> I assume you have checked out the BindingManager and all its uses?
>
> Steven
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Business object data binding hharry Microsoft ASP .NET 0 31st May 2007 10:45 PM
Binding data to object and its nested object (ASP.NET 2.0) Piotrek Microsoft ASP .NET 4 4th Aug 2006 12:09 PM
Object Data Binding Davie Microsoft C# .NET 2 16th Nov 2005 10:01 PM
Data binding to another object Sam Martin Microsoft C# .NET 1 17th Nov 2004 03:47 PM
Data Binding to a object... Simon Verona Microsoft VB .NET 19 25th Jun 2004 10:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:25 PM.