473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

complex object databinding

I have a very full and complex object that contains objects as properties
and a few collections, and I'm working to databind it to a page. A lot of
textbox and dropdowns on the page, a few grids. I'll need to be able to
easily read back edits on a postback, so I'm looking at different scenarios
that people have had to implement aside from the simple objectdatasource and
gridview examples.

Some suggestions I've seen involve using the ITypedList, IEditableObject, or
IBindingList. Still, most of the examples I see apply to special needs of
binding to collections. Does anyone here have any recommendations as far as
base classes I should have my object inherit from, or the right interface(s)
I need to use for my scenario?
Feb 5 '07 #1
2 2099
Howdy,

Have in mind complex expression evaluation works fine for Eval() method
(i.e. Eval("MyBusinessObject.Property.AnotherProperty")) , but don't expect it
works when binding values back to source via Bind() method: <asp:TextBind
runat="server" Text='<%# ("MyBusinessObject.Property.AnotherProperty") %>'/>
is not going to work. So evenif you implement all the interfaces,
objectdatasource, gridview or any data bound control may not understand
complex Bind() expression and you'll have to code it manually.

hope this helps
--
Milosz
"Random" wrote:
I have a very full and complex object that contains objects as properties
and a few collections, and I'm working to databind it to a page. A lot of
textbox and dropdowns on the page, a few grids. I'll need to be able to
easily read back edits on a postback, so I'm looking at different scenarios
that people have had to implement aside from the simple objectdatasource and
gridview examples.

Some suggestions I've seen involve using the ITypedList, IEditableObject, or
IBindingList. Still, most of the examples I see apply to special needs of
binding to collections. Does anyone here have any recommendations as far as
base classes I should have my object inherit from, or the right interface(s)
I need to use for my scenario?
Feb 6 '07 #2
Look at this code. Sorry I only have vb.net handy:
Take a look here, it might help:

CurrentPublisher.PublisherName is a nested property.


Dim titleIdBinding As Binding = _
txtTitleId.DataBindings.Add("Text", Me.m_model, "TitleId")

'Improved in .NET 2.0 //
http://msdn2.microsoft.com/library/y...us,vs.80).aspx
'titleIdBinding.NullValue = "Type a TitleID Here"

'a text box
Me.txtTitleId.DataBindings.Add(New Binding("Text", Me.m_model,
"TitleId"))

''a text box
Me.txtPublisher.DataBindings.Add(New Binding("Text", Me.m_model,
"CurrentPublisher.PublisherName"))
'a date control
Me.dtpPubDate.DataBindings.Add(New Binding("Value", Me.m_model,
"PublishedDate"))

'a text box
Me.txtPubDate.DataBindings.Add(New Binding("Text", Me.m_model,
"PublishedDate"))


class Publisher
--------------------
string PublisherName

class Title
-------------
string TitleId
strng Title
Publisher CurrentPublisher

"Random" <ci*******@hotmail.comwrote in message
news:O6*************@TK2MSFTNGP05.phx.gbl...
I have a very full and complex object that contains objects as properties
and a few collections, and I'm working to databind it to a page. A lot of
textbox and dropdowns on the page, a few grids. I'll need to be able to
easily read back edits on a postback, so I'm looking at different
scenarios
that people have had to implement aside from the simple objectdatasource
and
gridview examples.

Some suggestions I've seen involve using the ITypedList, IEditableObject,
or
IBindingList. Still, most of the examples I see apply to special needs of
binding to collections. Does anyone here have any recommendations as far
as
base classes I should have my object inherit from, or the right
interface(s)
I need to use for my scenario?


Feb 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Tim Jarvis | last post by:
Hi, I have an object that I am binding to a text box, this object exposes a boolean field, and I have implemented a format event handler and a parse event handler for the binding object, where I...
1
by: thzero | last post by:
Is there any way to do this without using the ObjectDataSource? (Apologies for the long post) I have a simple data object: public class TestDO { public TestDO() {} public ID { get; set; }...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
5
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
7
by: BS | last post by:
Hello everybody I'm calling a webservice that returns complex data. The goal is to populate a datagrid with it. Using a loop for each record found ( such as For i = 0 To...
13
by: TS | last post by:
Say i have a class car with properties: Color, Make, Model, Year, DriverID And a Driver class with properties: DriverID, Name The driverID PRIVATE property is the id of the driver from say a...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
2
by: Dustin Davis | last post by:
I've been having problems with databinding. I've created a simple solution to emulate the problem I can't figure out. Basically, I have a TextBox bound to a property in an object. When the property...
4
by: Jason Wolf | last post by:
I have an object which runs in a sperate thread, from the main thread, and while running it updates a public property. In my main form I defined databinding on the property and I would like to see...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.