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?