473,327 Members | 2,074 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,327 software developers and data experts.

Complex databinding

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
Jun 27 '08 #1
1 1440
On May 27, 7:35 am, "Craig Buchanan" <re...@newsgroup.comwrote:
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
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...ial-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

Jun 27 '08 #2

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

Similar topics

3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
3
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were...
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...
4
by: Matthew | last post by:
Hi, I am using a checkedlistbox on a windows form and binding it to a collection of classes. clbAliases is the checkedlistbox control selectedplace is a class with property placealiases.This...
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...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
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: Random | last post by:
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. ...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello to all, I want to know if DataBinding in asp.net 2,0 is better than to fill up the values of the controls of the following form: this.miControlTextBox.Text = valorParaControlTextbox; ...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.