Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Complex databinding

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Craig Buchanan - 27 May 2008 02:35 GMT
I have an class, named MessageTemplate, that has three properties: Name,
Description, and Tokens.  The Name and Description properties are strings.
The Tokens property, however, is a KeyedCollection of the Token class.  The
Token class has two string properties: Name and Pattern.

I have a third class, named MessageTemplateAdapter, that manages the
MessageTemplate's CRUD processes to a single XML file.  This works
correctly.

I am in the midst of creating a form to add/edit the MessageTemplate class.
I've created an ObjectDataSource to tie the MessageTemplateAdapter to a
DetailsView.  This works as expected for the Name and Description
properties.

I would like to bind the MessageTemplate's Tokens collection to a GridView
on the same form, then use the GridView to add/edit each Token.  Moreover, I
want the DetailsView's Insert/Update methods to save the collection's data
along w/ the Name and Description properties.  Essentially, I want to save
the parent and the child together.

While I'm able to bind the Tokens collection to GridView in the
DetailsView's DataBound event (the DetailView's DataItem), I haven't been
able to get the GridView's Edit/Delete/Insert to work.

Does anyone have a recommendation on how to handle complex data binding like
this?

Thanks in advance,

Craig
Munna - 27 May 2008 07:20 GMT
> I have an class, named MessageTemplate, that has three properties: Name,
> Description, and Tokens.  The Name and Description properties are strings.
[quoted text clipped - 26 lines]
>
> Craig

Hi,

this is a simple article to show master detail view with detail view
and grid view. which expain the view
http://www.asp.net/learn/data-access/tutorial-10-vb.aspx
i guess your main problem is create a crud module for you class
template.
I have few simple trik to help you since i have already worked on some
thing like that

1. create a simple user control consisting with detail view and a grid
view.
[grid view for tokens and detail view for messagetemple name and
description or perhaps you can create simple two textbox and labels
instead of detail view to make things easy]
2. implement mode for the user control (create,read,update,delete)
3. make a datasource property in the control
4. implement command button in the user control

5. when you add a new MessageTemplate start with null message
template.
upon user command create messagetemple class instance and fill the
class with data
and then save in database using your store procedure or what you have
used.

6. when updating/reading set the datasource property of the
usercontrol and then in on load the controls's data from the class

Thats it.

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.