Finding a way to bind ASP.NET controls(two way) to a typed-dataset

N

novus

In VS.NET 2005 there's no way to bind (two-way) ASP.NET controls to a
typed-dataset. All binding is done against the new DataSource controls. I’ve
got a tree tier architecture where data is transported through the tiers by
typed-datasets. So typically my business objects have a read function witch
returns a typed-dataset and also have save function which persist the
typed-dataset that is provided as a parameter.

My problem is that I'm not able to bind the typed-dataset to the controls.
When using a ObjectDataSource the methods that you need to configure for
select, update, insert and delete operations aren't what I want. I want the
grid to work on my dataset, and then when I decide it, I want to persist the
dataset in the database. I can have one dataset with several data tables that
is loaded in multiple forms, and I want to save it in the last step. I don't
see how I can wire that in the editors.

I ended up writing my own typed-dataset DataSourceControl which communicates
with my businessobject and calls a configurable read function for selecting
the data. The typed-dataset is stored in session state so changes can be made
to the same dataset between several postbacks from the client. Insert,
updates and deletes are all stored in the dataset. If the user is satisfied
with all the changes he can save them. The dataset is then passed to the
business object again to persist it in the datastore.

Could you provide me with information about a working sample of a custom
written datasource control that manipulates a typed dataset and that supports
the designer features of the datacontrols?

What is the best approach to solve this?
 
S

Steven Cheng[MSFT]

Hi Novus,

Welcome to ASPNET newsgroup.
From your description, you're developing a data manipulating web page
through the new ASP.NET 2.0 Databound control and DataSource control. Also,
since your datasource is a typed Dataset, you'd like to use
ObjectDataSource, however, currently since the default datasource control
only support updating one record directly to backend data storage each
time, you're wondering a good means to make the dataset batch updated
(update the whole dataset to database at one time), yes? If anything I
didn't understand well, please feel free to let me know.

As for this question, based on my experience, creating a custom datasource
control will be very time comsumed and won't quite address your problem.
Because the the limitation on your problem is actually due to the WebForm
programming model, in which databinding is one-way only (unlike in winform
which mantains two way databinding between databound control and in-memory
datasource objects.... In webform the databound control (such as GridView,
DataList... ) will bind each data record in to its control item and store
the values in viewstate (finally flush to clientside), so there is no
DataSet or other database object mantained by them. Also, when performing
data updating , the DataBound control will provide single item(record)'s
datas (old and new values of each columns ..... ).

Currently, my suggestion on this is that we can create a wrapper class
which work as a facade between the ObjectDataSource control and the
TypedDataSet object. We set this class as the object Type in the
DataSource control, and this class also has the corresponding select,
update... delete method... However, in this custom class's select
method, we get the Typed Dataset and cache it in application's memory
(either SessionState or Application Cache...), then in the update or delete
method, we perform single record update or delete in the in-memorty cached
dataset( not update directly to backend db.). And in the end we can update
the Whole Typed Dataset by another method on the custom classs....
How do you think of this?

If there're any other ideas or questions, please feel free to post here.
Thanks,


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
typed-dataset
| thread-index: AcXkbz4CSemtquzmQNyHP9g/A72JUA==
| X-WBNR-Posting-Host: 212.187.78.77
| From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| Subject: Finding a way to bind ASP.NET controls(two way) to a
typed-dataset
| Date: Tue, 8 Nov 2005 06:18:08 -0800
| Lines: 29
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:11764
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| In VS.NET 2005 there's no way to bind (two-way) ASP.NET controls to a
| typed-dataset. All binding is done against the new DataSource controls.
I’ve
| got a tree tier architecture where data is transported through the tiers
by
| typed-datasets. So typically my business objects have a read function
witch
| returns a typed-dataset and also have save function which persist the
| typed-dataset that is provided as a parameter.
|
| My problem is that I'm not able to bind the typed-dataset to the
controls.
| When using a ObjectDataSource the methods that you need to configure for
| select, update, insert and delete operations aren't what I want. I want
the
| grid to work on my dataset, and then when I decide it, I want to persist
the
| dataset in the database. I can have one dataset with several data tables
that
| is loaded in multiple forms, and I want to save it in the last step. I
don't
| see how I can wire that in the editors.
|
| I ended up writing my own typed-dataset DataSourceControl which
communicates
| with my businessobject and calls a configurable read function for
selecting
| the data. The typed-dataset is stored in session state so changes can be
made
| to the same dataset between several postbacks from the client. Insert,
| updates and deletes are all stored in the dataset. If the user is
satisfied
| with all the changes he can save them. The dataset is then passed to the
| business object again to persist it in the datastore.
|
| Could you provide me with information about a working sample of a custom
| written datasource control that manipulates a typed dataset and that
supports
| the designer features of the datacontrols?
|
| What is the best approach to solve this?
|
|
 
N

novus

Hi Steven,

Your description of the problem is correct.

In your post you mention that two-way data binding is not supported on
WebForms? Maybe not as it’s working technically for WinForms, but for example
the FormView control does support two-way databinding or do I miss something.

I don’t understand why a custom datasource wouldn’t address my problem. I
already have made a start writing one and it does the job but it isn’t foul
proof yet. By writing my own datasource I don’t have to write all the wrapper
classes for my business objects an maintain them in the future as my business
object change. The custom datasource can cache the typed dataset in session.
I also think it’s more time consuming to maintain a dozen of wrapper classes
in the future than writing a good datasource once. Do you now where I can
find more information about writing a custom datasource other than what the
MSDN documentation provide.

Another thing about the ObjectDataSource is that it’s only capable of
manipulating the defaultview. So if I’am working with three tables on one
WebForm, I have to add three ObjectDataSources to do the job.

It feels that the wrapper class solution will be the quickest solution for
now but isn’t for the future.
 
S

Steven Cheng[MSFT]

Thanks for your response novus,

Yes, I totally agree with you on the "strength" and weakness between using
a Custom DataSource control and a wrapper class.... And a well-defined
custom datasource will greatly improve the reusability and flexibility.

BTW, as for the below comments you added:
==================
Another thing about the ObjectDataSource is that it’s only capable of
manipulating the defaultview. So if I’am working with three tables on one
WebForm, I have to add three ObjectDataSources to do the job.
==================

I have some different opinions, maybe we're considering the problem from
different perspective:

IMO, I think that we should let the ObjectDataSource control do less things
and let our custom class do more things so that we can make the
ObjectDataSource more common and simple. So as for the problem in this
thread, my "wrapper class" approach is just let our custom class do more
things to match the ObjectDataSource control. While your approach is making
change on the ObjectDataSource so as to let datasource match our custom
object. Do you think so?

Anyway, I think both means has its own highlight and drawback. And in your
application ,since there may have many such custom dataaccessing objects
which need to behavior like the same style(storing in temp memory cache and
batch updating ....), then do the customizing on the datasource control is
more suitable.

Just some of my opinions.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| thread-index: AcXlFQyGikep/CNAT9+CWDpaOM12kQ==
| X-WBNR-Posting-Host: 212.187.78.77
| From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| Date: Wed, 9 Nov 2005 02:05:01 -0800
| Lines: 149
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31025
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Hi Steven,
|
| Your description of the problem is correct.
|
| In your post you mention that two-way data binding is not supported on
| WebForms? Maybe not as it’s working technically for WinForms, but for
example
| the FormView control does support two-way databinding or do I miss
something.
|
| I don’t understand why a custom datasource wouldn’t address my
problem. I
| already have made a start writing one and it does the job but it isn’t
foul
| proof yet. By writing my own datasource I don’t have to write all the
wrapper
| classes for my business objects an maintain them in the future as my
business
| object change. The custom datasource can cache the typed dataset in
session.
| I also think it’s more time consuming to maintain a dozen of wrapper
classes
| in the future than writing a good datasource once. Do you now where I can
| find more information about writing a custom datasource other than what
the
| MSDN documentation provide.
|
| Another thing about the ObjectDataSource is that it’s only capable of
| manipulating the defaultview. So if I’am working with three tables on
one
| WebForm, I have to add three ObjectDataSources to do the job.
|
| It feels that the wrapper class solution will be the quickest solution
for
| now but isn’t for the future.
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Novus,
| >
| > Welcome to ASPNET newsgroup.
| > From your description, you're developing a data manipulating web page
| > through the new ASP.NET 2.0 Databound control and DataSource control.
Also,
| > since your datasource is a typed Dataset, you'd like to use
| > ObjectDataSource, however, currently since the default datasource
control
| > only support updating one record directly to backend data storage each
| > time, you're wondering a good means to make the dataset batch updated
| > (update the whole dataset to database at one time), yes? If anything I
| > didn't understand well, please feel free to let me know.
| >
| > As for this question, based on my experience, creating a custom
datasource
| > control will be very time comsumed and won't quite address your
problem.
| > Because the the limitation on your problem is actually due to the
WebForm
| > programming model, in which databinding is one-way only (unlike in
winform
| > which mantains two way databinding between databound control and
in-memory
| > datasource objects.... In webform the databound control (such as
GridView,
| > DataList... ) will bind each data record in to its control item and
store
| > the values in viewstate (finally flush to clientside), so there is no
| > DataSet or other database object mantained by them. Also, when
performing
| > data updating , the DataBound control will provide single
item(record)'s
| > datas (old and new values of each columns ..... ).
| >
| > Currently, my suggestion on this is that we can create a wrapper class
| > which work as a facade between the ObjectDataSource control and the
| > TypedDataSet object. We set this class as the object Type in the
| > DataSource control, and this class also has the corresponding select,
| > update... delete method... However, in this custom class's select
| > method, we get the Typed Dataset and cache it in application's memory
| > (either SessionState or Application Cache...), then in the update or
delete
| > method, we perform single record update or delete in the in-memorty
cached
| > dataset( not update directly to backend db.). And in the end we can
update
| > the Whole Typed Dataset by another method on the custom classs....
| > How do you think of this?
| >
| > If there're any other ideas or questions, please feel free to post
here.
| > Thanks,
| >
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
| > typed-dataset
| > | thread-index: AcXkbz4CSemtquzmQNyHP9g/A72JUA==
| > | X-WBNR-Posting-Host: 212.187.78.77
| > | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| > | Subject: Finding a way to bind ASP.NET controls(two way) to a
| > typed-dataset
| > | Date: Tue, 8 Nov 2005 06:18:08 -0800
| > | Lines: 29
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 8bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:11764
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | In VS.NET 2005 there's no way to bind (two-way) ASP.NET controls to a
| > | typed-dataset. All binding is done against the new DataSource
controls.
| > I’ve
| > | got a tree tier architecture where data is transported through the
tiers
| > by
| > | typed-datasets. So typically my business objects have a read function
| > witch
| > | returns a typed-dataset and also have save function which persist the
| > | typed-dataset that is provided as a parameter.
| > |
| > | My problem is that I'm not able to bind the typed-dataset to the
| > controls.
| > | When using a ObjectDataSource the methods that you need to configure
for
| > | select, update, insert and delete operations aren't what I want. I
want
| > the
| > | grid to work on my dataset, and then when I decide it, I want to
persist
| > the
| > | dataset in the database. I can have one dataset with several data
tables
| > that
| > | is loaded in multiple forms, and I want to save it in the last step.
I
| > don't
| > | see how I can wire that in the editors.
| > |
| > | I ended up writing my own typed-dataset DataSourceControl which
| > communicates
| > | with my businessobject and calls a configurable read function for
| > selecting
| > | the data. The typed-dataset is stored in session state so changes can
be
| > made
| > | to the same dataset between several postbacks from the client.
Insert,
| > | updates and deletes are all stored in the dataset. If the user is
| > satisfied
| > | with all the changes he can save them. The dataset is then passed to
the
| > | business object again to persist it in the datastore.
| > |
| > | Could you provide me with information about a working sample of a
custom
| > | written datasource control that manipulates a typed dataset and that
| > supports
| > | the designer features of the datacontrols?
| > |
| > | What is the best approach to solve this?
| > |
| > |
| >
| >
|
 
N

novus

on the microsoft newsgroup i asked the same question.

There i understand that making my own datasource is the best approach.

I have tried that but it is hard to find any information or documentation
about it. Especially if i want to use the design view as well.

Can you please tell me where i can find more? Or even better could you send
me a proto-type?

thanx

Steven Cheng said:
Thanks for your response novus,

Yes, I totally agree with you on the "strength" and weakness between using
a Custom DataSource control and a wrapper class.... And a well-defined
custom datasource will greatly improve the reusability and flexibility.

BTW, as for the below comments you added:
==================
Another thing about the ObjectDataSource is that it’s only capable of
manipulating the defaultview. So if I’am working with three tables on one
WebForm, I have to add three ObjectDataSources to do the job.
==================

I have some different opinions, maybe we're considering the problem from
different perspective:

IMO, I think that we should let the ObjectDataSource control do less things
and let our custom class do more things so that we can make the
ObjectDataSource more common and simple. So as for the problem in this
thread, my "wrapper class" approach is just let our custom class do more
things to match the ObjectDataSource control. While your approach is making
change on the ObjectDataSource so as to let datasource match our custom
object. Do you think so?

Anyway, I think both means has its own highlight and drawback. And in your
application ,since there may have many such custom dataaccessing objects
which need to behavior like the same style(storing in temp memory cache and
batch updating ....), then do the customizing on the datasource control is
more suitable.

Just some of my opinions.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| thread-index: AcXlFQyGikep/CNAT9+CWDpaOM12kQ==
| X-WBNR-Posting-Host: 212.187.78.77
| From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| Date: Wed, 9 Nov 2005 02:05:01 -0800
| Lines: 149
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31025
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Hi Steven,
|
| Your description of the problem is correct.
|
| In your post you mention that two-way data binding is not supported on
| WebForms? Maybe not as it’s working technically for WinForms, but for
example
| the FormView control does support two-way databinding or do I miss
something.
|
| I don’t understand why a custom datasource wouldn’t address my
problem. I
| already have made a start writing one and it does the job but it isn’t
foul
| proof yet. By writing my own datasource I don’t have to write all the
wrapper
| classes for my business objects an maintain them in the future as my
business
| object change. The custom datasource can cache the typed dataset in
session.
| I also think it’s more time consuming to maintain a dozen of wrapper
classes
| in the future than writing a good datasource once. Do you now where I can
| find more information about writing a custom datasource other than what
the
| MSDN documentation provide.
|
| Another thing about the ObjectDataSource is that it’s only capable of
| manipulating the defaultview. So if I’am working with three tables on
one
| WebForm, I have to add three ObjectDataSources to do the job.
|
| It feels that the wrapper class solution will be the quickest solution
for
| now but isn’t for the future.
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Novus,
| >
| > Welcome to ASPNET newsgroup.
| > From your description, you're developing a data manipulating web page
| > through the new ASP.NET 2.0 Databound control and DataSource control.
Also,
| > since your datasource is a typed Dataset, you'd like to use
| > ObjectDataSource, however, currently since the default datasource
control
| > only support updating one record directly to backend data storage each
| > time, you're wondering a good means to make the dataset batch updated
| > (update the whole dataset to database at one time), yes? If anything I
| > didn't understand well, please feel free to let me know.
| >
| > As for this question, based on my experience, creating a custom
datasource
| > control will be very time comsumed and won't quite address your
problem.
| > Because the the limitation on your problem is actually due to the
WebForm
| > programming model, in which databinding is one-way only (unlike in
winform
| > which mantains two way databinding between databound control and
in-memory
| > datasource objects.... In webform the databound control (such as
GridView,
| > DataList... ) will bind each data record in to its control item and
store
| > the values in viewstate (finally flush to clientside), so there is no
| > DataSet or other database object mantained by them. Also, when
performing
| > data updating , the DataBound control will provide single
item(record)'s
| > datas (old and new values of each columns ..... ).
| >
| > Currently, my suggestion on this is that we can create a wrapper class
| > which work as a facade between the ObjectDataSource control and the
| > TypedDataSet object. We set this class as the object Type in the
| > DataSource control, and this class also has the corresponding select,
| > update... delete method... However, in this custom class's select
| > method, we get the Typed Dataset and cache it in application's memory
| > (either SessionState or Application Cache...), then in the update or
delete
| > method, we perform single record update or delete in the in-memorty
cached
| > dataset( not update directly to backend db.). And in the end we can
update
| > the Whole Typed Dataset by another method on the custom classs....
| > How do you think of this?
| >
| > If there're any other ideas or questions, please feel free to post
here.
| > Thanks,
| >
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
| > typed-dataset
| > | thread-index: AcXkbz4CSemtquzmQNyHP9g/A72JUA==
| > | X-WBNR-Posting-Host: 212.187.78.77
| > | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| > | Subject: Finding a way to bind ASP.NET controls(two way) to a
| > typed-dataset
| > | Date: Tue, 8 Nov 2005 06:18:08 -0800
| > | Lines: 29
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 8bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:11764
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | In VS.NET 2005 there's no way to bind (two-way) ASP.NET controls to a
| > | typed-dataset. All binding is done against the new DataSource
controls.
| > I’ve
| > | got a tree tier architecture where data is transported through the
tiers
| > by
| > | typed-datasets. So typically my business objects have a read function
| > witch
| > | returns a typed-dataset and also have save function which persist the
| > | typed-dataset that is provided as a parameter.
| > |
| > | My problem is that I'm not able to bind the typed-dataset to the
| > controls.
| > | When using a ObjectDataSource the methods that you need to configure
for
| > | select, update, insert and delete operations aren't what I want. I
want
| > the
| > | grid to work on my dataset, and then when I decide it, I want to
persist
| > the
| > | dataset in the database. I can have one dataset with several data
tables
| > that
| > | is loaded in multiple forms, and I want to save it in the last step.
I
| > don't
| > | see how I can wire that in the editors.
| > |
| > | I ended up writing my own typed-dataset DataSourceControl which
| > communicates
| > | with my businessobject and calls a configurable read function for
| > selecting
| > | the data. The typed-dataset is stored in session state so changes can
be
| > made
| > | to the same dataset between several postbacks from the client.
Insert,
| > | updates and deletes are all stored in the dataset. If the user is
| > satisfied
| > | with all the changes he can save them. The dataset is then passed to
the
| > | business object again to persist it in the datastore.
| > |
| > | Could you provide me with information about a working sample of a
custom
| > | written datasource control that manipulates a typed dataset and that
| > supports
| > | the designer features of the datacontrols?
| > |
| > | What is the best approach to solve this?
| > |
| > |
| >
| >
|
 
S

Steven Cheng[MSFT]

Hi Novus,

As for Custom DataSource control, there seems haven't detailed reference or
tutorial on this. What I've found is that we should at least implement the
IDataSource interface. And for detailed info on creating a well-defined
datasource control, I think the best means maybe view the .net buildin
datasource control's proto type. If you have interents, you can use
reflector tool to get details view on those buildin datasource controls.

For deisgner time support, here are some reference in MSDN which maybe
helpful:

#Simplify UI Development with Custom Designer Actions in Visual Studio
http://msdn.microsoft.com/msdnmag/issues/05/07/DesignerActions/default.aspx

#Sample Control Design
http://msdn2.microsoft.com/en-us/library/d0etxzd8er with Action Lists and
Services

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| thread-index: AcXmKLHPy69rEeB5RXKmmvrFt5t70A==
| X-WBNR-Posting-Host: 213.73.245.168
| From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| Date: Thu, 10 Nov 2005 10:58:10 -0800
| Lines: 274
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31062
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| on the microsoft newsgroup i asked the same question.
|
| There i understand that making my own datasource is the best approach.
|
| I have tried that but it is hard to find any information or documentation
| about it. Especially if i want to use the design view as well.
|
| Can you please tell me where i can find more? Or even better could you
send
| me a proto-type?
|
| thanx
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for your response novus,
| >
| > Yes, I totally agree with you on the "strength" and weakness between
using
| > a Custom DataSource control and a wrapper class.... And a well-defined
| > custom datasource will greatly improve the reusability and flexibility.
| >
| > BTW, as for the below comments you added:
| > ==================
| > Another thing about the ObjectDataSource is that it’s only
capable of
| > manipulating the defaultview. So if I’am working with three
tables on one
| > WebForm, I have to add three ObjectDataSources to do the job.
| > ==================
| >
| > I have some different opinions, maybe we're considering the problem
from
| > different perspective:
| >
| > IMO, I think that we should let the ObjectDataSource control do less
things
| > and let our custom class do more things so that we can make the
| > ObjectDataSource more common and simple. So as for the problem in this
| > thread, my "wrapper class" approach is just let our custom class do
more
| > things to match the ObjectDataSource control. While your approach is
making
| > change on the ObjectDataSource so as to let datasource match our custom
| > object. Do you think so?
| >
| > Anyway, I think both means has its own highlight and drawback. And in
your
| > application ,since there may have many such custom dataaccessing
objects
| > which need to behavior like the same style(storing in temp memory cache
and
| > batch updating ....), then do the customizing on the datasource control
is
| > more suitable.
| >
| > Just some of my opinions.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
| > typed-dat
| > | thread-index: AcXlFQyGikep/CNAT9+CWDpaOM12kQ==
| > | X-WBNR-Posting-Host: 212.187.78.77
| > | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > | Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
| > typed-dat
| > | Date: Wed, 9 Nov 2005 02:05:01 -0800
| > | Lines: 149
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 8bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:31025
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Hi Steven,
| > |
| > | Your description of the problem is correct.
| > |
| > | In your post you mention that two-way data binding is not supported
on
| > | WebForms? Maybe not as it’s working technically for WinForms,
but for
| > example
| > | the FormView control does support two-way databinding or do I miss
| > something.
| > |
| > | I don’t understand why a custom datasource wouldn’t
address my
| > problem. I
| > | already have made a start writing one and it does the job but it isnÃ
¢â‚¬â„¢t
| > foul
| > | proof yet. By writing my own datasource I don’t have to write
all the
| > wrapper
| > | classes for my business objects an maintain them in the future as my
| > business
| > | object change. The custom datasource can cache the typed dataset in
| > session.
| > | I also think it’s more time consuming to maintain a dozen of
wrapper
| > classes
| > | in the future than writing a good datasource once. Do you now where I
can
| > | find more information about writing a custom datasource other than
what
| > the
| > | MSDN documentation provide.
| > |
| > | Another thing about the ObjectDataSource is that it’s only
capable of
| > | manipulating the defaultview. So if I’am working with three
tables on
| > one
| > | WebForm, I have to add three ObjectDataSources to do the job.
| > |
| > | It feels that the wrapper class solution will be the quickest
solution
| > for
| > | now but isn’t for the future.
| > |
| > |
| > | "Steven Cheng[MSFT]" wrote:
| > |
| > | > Hi Novus,
| > | >
| > | > Welcome to ASPNET newsgroup.
| > | > From your description, you're developing a data manipulating web
page
| > | > through the new ASP.NET 2.0 Databound control and DataSource
control.
| > Also,
| > | > since your datasource is a typed Dataset, you'd like to use
| > | > ObjectDataSource, however, currently since the default datasource
| > control
| > | > only support updating one record directly to backend data storage
each
| > | > time, you're wondering a good means to make the dataset batch
updated
| > | > (update the whole dataset to database at one time), yes? If
anything I
| > | > didn't understand well, please feel free to let me know.
| > | >
| > | > As for this question, based on my experience, creating a custom
| > datasource
| > | > control will be very time comsumed and won't quite address your
| > problem.
| > | > Because the the limitation on your problem is actually due to the
| > WebForm
| > | > programming model, in which databinding is one-way only (unlike in
| > winform
| > | > which mantains two way databinding between databound control and
| > in-memory
| > | > datasource objects.... In webform the databound control (such as
| > GridView,
| > | > DataList... ) will bind each data record in to its control item and
| > store
| > | > the values in viewstate (finally flush to clientside), so there is
no
| > | > DataSet or other database object mantained by them. Also, when
| > performing
| > | > data updating , the DataBound control will provide single
| > item(record)'s
| > | > datas (old and new values of each columns ..... ).
| > | >
| > | > Currently, my suggestion on this is that we can create a wrapper
class
| > | > which work as a facade between the ObjectDataSource control and the
| > | > TypedDataSet object. We set this class as the object Type in the
| > | > DataSource control, and this class also has the corresponding
select,
| > | > update... delete method... However, in this custom class's
select
| > | > method, we get the Typed Dataset and cache it in application's
memory
| > | > (either SessionState or Application Cache...), then in the update
or
| > delete
| > | > method, we perform single record update or delete in the in-memorty
| > cached
| > | > dataset( not update directly to backend db.). And in the end we can
| > update
| > | > the Whole Typed Dataset by another method on the custom classs....
| > | > How do you think of this?
| > | >
| > | > If there're any other ideas or questions, please feel free to post
| > here.
| > | > Thanks,
| > | >
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to
a
| > | > typed-dataset
| > | > | thread-index: AcXkbz4CSemtquzmQNyHP9g/A72JUA==
| > | > | X-WBNR-Posting-Host: 212.187.78.77
| > | > | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| > | > | Subject: Finding a way to bind ASP.NET controls(two way) to a
| > | > typed-dataset
| > | > | Date: Tue, 8 Nov 2005 06:18:08 -0800
| > | > | Lines: 29
| > | > | Message-ID: <[email protected]>
| > | > | MIME-Version: 1.0
| > | > | Content-Type: text/plain;
| > | > | charset="Utf-8"
| > | > | Content-Transfer-Encoding: 8bit
| > | > | X-Newsreader: Microsoft CDO for Windows 2000
| > | > | Content-Class: urn:content-classes:message
| > | > | Importance: normal
| > | > | Priority: normal
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:11764
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | In VS.NET 2005 there's no way to bind (two-way) ASP.NET controls
to a
| > | > | typed-dataset. All binding is done against the new DataSource
| > controls.
| > | > I’ve
| > | > | got a tree tier architecture where data is transported through
the
| > tiers
| > | > by
| > | > | typed-datasets. So typically my business objects have a read
function
| > | > witch
| > | > | returns a typed-dataset and also have save function which persist
the
| > | > | typed-dataset that is provided as a parameter.
| > | > |
| > | > | My problem is that I'm not able to bind the typed-dataset to the
| > | > controls.
| > | > | When using a ObjectDataSource the methods that you need to
configure
| > for
| > | > | select, update, insert and delete operations aren't what I want.
I
| > want
| > | > the
| > | > | grid to work on my dataset, and then when I decide it, I want to
| > persist
| > | > the
| > | > | dataset in the database. I can have one dataset with several data
| > tables
| > | > that
| > | > | is loaded in multiple forms, and I want to save it in the last
step.
| > I
| > | > don't
| > | > | see how I can wire that in the editors.
| > | > |
| > | > | I ended up writing my own typed-dataset DataSourceControl which
| > | > communicates
| > | > | with my businessobject and calls a configurable read function for
| > | > selecting
| > | > | the data. The typed-dataset is stored in session state so changes
can
| > be
| > | > made
| > | > | to the same dataset between several postbacks from the client.
| > Insert,
| > | > | updates and deletes are all stored in the dataset. If the user is
| > | > satisfied
| > | > | with all the changes he can save them. The dataset is then passed
to
| > the
| > | > | business object again to persist it in the datastore.
| > | > |
| > | > | Could you provide me with information about a working sample of a
| > custom
| > | > | written datasource control that manipulates a typed dataset and
that
| > | > supports
| > | > | the designer features of the datacontrols?
| > | > |
| > | > | What is the best approach to solve this?
| > | > |
| > | > |
| > | >
| > | >
| > |
| >
| >
|
 
S

Steven Cheng[MSFT]

Hi Novus,

Any further progress on this or does the things in my last reply helps a
little? If still anything we can help, please feel free to post here.
Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 133076641
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Fri, 11 Nov 2005 07:57:11 GMT
| Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
typed-dat
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Lines: 354
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:31078
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Novus,
|
| As for Custom DataSource control, there seems haven't detailed reference
or
| tutorial on this. What I've found is that we should at least implement
the
| IDataSource interface. And for detailed info on creating a well-defined
| datasource control, I think the best means maybe view the .net buildin
| datasource control's proto type. If you have interents, you can use
| reflector tool to get details view on those buildin datasource controls.
|
| For deisgner time support, here are some reference in MSDN which maybe
| helpful:
|
| #Simplify UI Development with Custom Designer Actions in Visual Studio
|
http://msdn.microsoft.com/msdnmag/issues/05/07/DesignerActions/default.aspx
|
| #Sample Control Design
| http://msdn2.microsoft.com/en-us/library/d0etxzd8er with Action Lists and
| Services
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
| --------------------
| | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
| typed-dat
| | thread-index: AcXmKLHPy69rEeB5RXKmmvrFt5t70A==
| | X-WBNR-Posting-Host: 213.73.245.168
| | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| | References: <[email protected]>
| <[email protected]>
| <[email protected]>
| <[email protected]>
| | Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
| typed-dat
| | Date: Thu, 10 Nov 2005 10:58:10 -0800
| | Lines: 274
| | Message-ID: <[email protected]>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 8bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontrols:31062
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| |
| | on the microsoft newsgroup i asked the same question.
| |
| | There i understand that making my own datasource is the best approach.
| |
| | I have tried that but it is hard to find any information or
documentation
| | about it. Especially if i want to use the design view as well.
| |
| | Can you please tell me where i can find more? Or even better could you
| send
| | me a proto-type?
| |
| | thanx
| |
| | "Steven Cheng[MSFT]" wrote:
| |
| | > Thanks for your response novus,
| | >
| | > Yes, I totally agree with you on the "strength" and weakness between
| using
| | > a Custom DataSource control and a wrapper class.... And a
well-defined
| | > custom datasource will greatly improve the reusability and
flexibility.
| | >
| | > BTW, as for the below comments you added:
| | > ==================
| | > Another thing about the ObjectDataSource is that it’s only
| capable of
| | > manipulating the defaultview. So if I’am working with three
| tables on one
| | > WebForm, I have to add three ObjectDataSources to do the job.
| | > ==================
| | >
| | > I have some different opinions, maybe we're considering the problem
| from
| | > different perspective:
| | >
| | > IMO, I think that we should let the ObjectDataSource control do less
| things
| | > and let our custom class do more things so that we can make the
| | > ObjectDataSource more common and simple. So as for the problem in
this
| | > thread, my "wrapper class" approach is just let our custom class do
| more
| | > things to match the ObjectDataSource control. While your approach is
| making
| | > change on the ObjectDataSource so as to let datasource match our
custom
| | > object. Do you think so?
| | >
| | > Anyway, I think both means has its own highlight and drawback. And in
| your
| | > application ,since there may have many such custom dataaccessing
| objects
| | > which need to behavior like the same style(storing in temp memory
cache
| and
| | > batch updating ....), then do the customizing on the datasource
control
| is
| | > more suitable.
| | >
| | > Just some of my opinions.
| | >
| | > Thanks,
| | >
| | > Steven Cheng
| | > Microsoft Online Support
| | >
| | > Get Secure! www.microsoft.com/security
| | > (This posting is provided "AS IS", with no warranties, and confers no
| | > rights.)
| | >
| | >
| | > --------------------
| | > | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a
| | > typed-dat
| | > | thread-index: AcXlFQyGikep/CNAT9+CWDpaOM12kQ==
| | > | X-WBNR-Posting-Host: 212.187.78.77
| | > | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| | > | References: <[email protected]>
| | > <[email protected]>
| | > | Subject: RE: Finding a way to bind ASP.NET controls(two way) to a
| | > typed-dat
| | > | Date: Wed, 9 Nov 2005 02:05:01 -0800
| | > | Lines: 149
| | > | Message-ID: <[email protected]>
| | > | MIME-Version: 1.0
| | > | Content-Type: text/plain;
| | > | charset="Utf-8"
| | > | Content-Transfer-Encoding: 8bit
| | > | X-Newsreader: Microsoft CDO for Windows 2000
| | > | Content-Class: urn:content-classes:message
| | > | Importance: normal
| | > | Priority: normal
| | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | > | Xref: TK2MSFTNGXA02.phx.gbl
| | > microsoft.public.dotnet.framework.aspnet.webcontrols:31025
| | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| | > |
| | > | Hi Steven,
| | > |
| | > | Your description of the problem is correct.
| | > |
| | > | In your post you mention that two-way data binding is not supported
| on
| | > | WebForms? Maybe not as it’s working technically for
WinForms,
| but for
| | > example
| | > | the FormView control does support two-way databinding or do I miss
| | > something.
| | > |
| | > | I don’t understand why a custom datasource wouldn’t
| address my
| | > problem. I
| | > | already have made a start writing one and it does the job but it
isn?
¢â‚¬â„¢t
| | > foul
| | > | proof yet. By writing my own datasource I don’t have to
write
| all the
| | > wrapper
| | > | classes for my business objects an maintain them in the future as
my
| | > business
| | > | object change. The custom datasource can cache the typed dataset in
| | > session.
| | > | I also think it’s more time consuming to maintain a dozen of
| wrapper
| | > classes
| | > | in the future than writing a good datasource once. Do you now where
I
| can
| | > | find more information about writing a custom datasource other than
| what
| | > the
| | > | MSDN documentation provide.
| | > |
| | > | Another thing about the ObjectDataSource is that it’s only
| capable of
| | > | manipulating the defaultview. So if I’am working with three
| tables on
| | > one
| | > | WebForm, I have to add three ObjectDataSources to do the job.
| | > |
| | > | It feels that the wrapper class solution will be the quickest
| solution
| | > for
| | > | now but isn’t for the future.
| | > |
| | > |
| | > | "Steven Cheng[MSFT]" wrote:
| | > |
| | > | > Hi Novus,
| | > | >
| | > | > Welcome to ASPNET newsgroup.
| | > | > From your description, you're developing a data manipulating web
| page
| | > | > through the new ASP.NET 2.0 Databound control and DataSource
| control.
| | > Also,
| | > | > since your datasource is a typed Dataset, you'd like to use
| | > | > ObjectDataSource, however, currently since the default datasource
| | > control
| | > | > only support updating one record directly to backend data storage
| each
| | > | > time, you're wondering a good means to make the dataset batch
| updated
| | > | > (update the whole dataset to database at one time), yes? If
| anything I
| | > | > didn't understand well, please feel free to let me know.
| | > | >
| | > | > As for this question, based on my experience, creating a custom
| | > datasource
| | > | > control will be very time comsumed and won't quite address your
| | > problem.
| | > | > Because the the limitation on your problem is actually due to the
| | > WebForm
| | > | > programming model, in which databinding is one-way only (unlike
in
| | > winform
| | > | > which mantains two way databinding between databound control and
| | > in-memory
| | > | > datasource objects.... In webform the databound control (such as
| | > GridView,
| | > | > DataList... ) will bind each data record in to its control item
and
| | > store
| | > | > the values in viewstate (finally flush to clientside), so there
is
| no
| | > | > DataSet or other database object mantained by them. Also, when
| | > performing
| | > | > data updating , the DataBound control will provide single
| | > item(record)'s
| | > | > datas (old and new values of each columns ..... ).
| | > | >
| | > | > Currently, my suggestion on this is that we can create a wrapper
| class
| | > | > which work as a facade between the ObjectDataSource control and
the
| | > | > TypedDataSet object. We set this class as the object Type in the
| | > | > DataSource control, and this class also has the corresponding
| select,
| | > | > update... delete method... However, in this custom class's
| select
| | > | > method, we get the Typed Dataset and cache it in application's
| memory
| | > | > (either SessionState or Application Cache...), then in the update
| or
| | > delete
| | > | > method, we perform single record update or delete in the
in-memorty
| | > cached
| | > | > dataset( not update directly to backend db.). And in the end we
can
| | > update
| | > | > the Whole Typed Dataset by another method on the custom
classs....
| | > | > How do you think of this?
| | > | >
| | > | > If there're any other ideas or questions, please feel free to
post
| | > here.
| | > | > Thanks,
| | > | >
| | > | >
| | > | > Steven Cheng
| | > | > Microsoft Online Support
| | > | >
| | > | > Get Secure! www.microsoft.com/security
| | > | > (This posting is provided "AS IS", with no warranties, and
confers
| no
| | > | > rights.)
| | > | >
| | > | >
| | > | >
| | > | > --------------------
| | > | > | Thread-Topic: Finding a way to bind ASP.NET controls(two way)
to
| a
| | > | > typed-dataset
| | > | > | thread-index: AcXkbz4CSemtquzmQNyHP9g/A72JUA==
| | > | > | X-WBNR-Posting-Host: 212.187.78.77
| | > | > | From: "=?Utf-8?B?bm92dXM=?=" <[email protected]>
| | > | > | Subject: Finding a way to bind ASP.NET controls(two way) to a
| | > | > typed-dataset
| | > | > | Date: Tue, 8 Nov 2005 06:18:08 -0800
| | > | > | Lines: 29
| | > | > | Message-ID: <[email protected]>
| | > | > | MIME-Version: 1.0
| | > | > | Content-Type: text/plain;
| | > | > | charset="Utf-8"
| | > | > | Content-Transfer-Encoding: 8bit
| | > | > | X-Newsreader: Microsoft CDO for Windows 2000
| | > | > | Content-Class: urn:content-classes:message
| | > | > | Importance: normal
| | > | > | Priority: normal
| | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| | > | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | > | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:11764
| | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.webcontrols
| | > | > |
| | > | > | In VS.NET 2005 there's no way to bind (two-way) ASP.NET
controls
| to a
| | > | > | typed-dataset. All binding is done against the new DataSource
| | > controls.
| | > | > I’ve
| | > | > | got a tree tier architecture where data is transported through
| the
| | > tiers
| | > | > by
| | > | > | typed-datasets. So typically my business objects have a read
| function
| | > | > witch
| | > | > | returns a typed-dataset and also have save function which
persist
| the
| | > | > | typed-dataset that is provided as a parameter.
| | > | > |
| | > | > | My problem is that I'm not able to bind the typed-dataset to
the
| | > | > controls.
| | > | > | When using a ObjectDataSource the methods that you need to
| configure
| | > for
| | > | > | select, update, insert and delete operations aren't what I
want.
| I
| | > want
| | > | > the
| | > | > | grid to work on my dataset, and then when I decide it, I want
to
| | > persist
| | > | > the
| | > | > | dataset in the database. I can have one dataset with several
data
| | > tables
| | > | > that
| | > | > | is loaded in multiple forms, and I want to save it in the last
| step.
| | > I
| | > | > don't
| | > | > | see how I can wire that in the editors.
| | > | > |
| | > | > | I ended up writing my own typed-dataset DataSourceControl which
| | > | > communicates
| | > | > | with my businessobject and calls a configurable read function
for
| | > | > selecting
| | > | > | the data. The typed-dataset is stored in session state so
changes
| can
| | > be
| | > | > made
| | > | > | to the same dataset between several postbacks from the client.
| | > Insert,
| | > | > | updates and deletes are all stored in the dataset. If the user
is
| | > | > satisfied
| | > | > | with all the changes he can save them. The dataset is then
passed
| to
| | > the
| | > | > | business object again to persist it in the datastore.
| | > | > |
| | > | > | Could you provide me with information about a working sample of
a
| | > custom
| | > | > | written datasource control that manipulates a typed dataset and
| that
| | > | > supports
| | > | > | the designer features of the datacontrols?
| | > | > |
| | > | > | What is the best approach to solve this?
| | > | > |
| | > | > |
| | > | >
| | > | >
| | > |
| | >
| | >
| |
|
|
 
S

s.gregory

Are there any decent resources on binding to strongly typed datasets or
the best way to create wrappers for them?

I too am attempting to persist dataset changes between page requests
and so want to 'relieve' the ObjectDataSource control of the
responsibility for retreiving the data from the database/web service.

Even in the simple case of retreiving the data to bind I have a dilemma
over which is return type for my wrapper's Select method:

xxxDataTable - With the exception of the GridView, there doesn't seem
to be an easy way to specify a sort for the internal dataview when
bound by the ObjectDataSource to any other control!?
DataView - you can perform your own sort and filter, but you are then
unable to view the Fields in the designer.
List(Of xxxRow) - Allows you to perform you're own sort and filter &
view fields in the designer, but then seems to have problems with Null
values in fields.

Is there another way I'm missing here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top