Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Finding a way to bind ASP.NET controls(two way) to a typed-dataset

Reply
Thread Tools

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

 
 
novus
Guest
Posts: n/a
 
      11-08-2005
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?

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-09-2005
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=?=" <(E-Mail Removed)>
| 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: <(E-Mail Removed)>
| 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.webcontro ls
| 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.webcontro ls:11764
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
|
| 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?
|
|

 
Reply With Quote
 
 
 
 
novus
Guest
Posts: n/a
 
      11-09-2005
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=?=" <(E-Mail Removed)>
> | 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: <(E-Mail Removed)>
> | 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.webcontro ls
> | 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.webcontro ls:11764
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
> |
> | 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?
> |
> |
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-10-2005
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=?=" <(E-Mail Removed)>
| References: <(E-Mail Removed)>
<(E-Mail Removed)>
| 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: <(E-Mail Removed)>
| 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.webcontro ls
| 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.webcontro ls:31025
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
|
| 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=?=" <(E-Mail Removed)>
| > | 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: <(E-Mail Removed)>
| > | 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.webcontro ls
| > | 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.webcontro ls:11764
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
| > |
| > | 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?
| > |
| > |
| >
| >
|

 
Reply With Quote
 
novus
Guest
Posts: n/a
 
      11-10-2005
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=?=" <(E-Mail Removed)>
> | References: <(E-Mail Removed)>
> <(E-Mail Removed)>
> | 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: <(E-Mail Removed)>
> | 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.webcontro ls
> | 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.webcontro ls:31025
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
> |
> | 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=?=" <(E-Mail Removed)>
> | > | 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: <(E-Mail Removed)>
> | > | 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.webcontro ls
> | > | 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.webcontro ls:11764
> | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
> | > |
> | > | 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?
> | > |
> | > |
> | >
> | >
> |
>
>

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-11-2005
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/is...s/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=?=" <(E-Mail Removed)>
| References: <(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
| 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: <(E-Mail Removed)>
| 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.webcontro ls
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontro ls:31062
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
|
| 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=?=" <(E-Mail Removed)>
| > | References: <(E-Mail Removed)>
| > <(E-Mail Removed)>
| > | 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: <(E-Mail Removed)>
| > | 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.webcontro ls
| > | 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.webcontro ls:31025
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
| > |
| > | 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=?=" <(E-Mail Removed)>
| > | > | 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: <(E-Mail Removed)>
| > | > | 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.webcontro ls
| > | > | 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.webcontro ls:11764
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
| > | > |
| > | > | 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?
| > | > |
| > | > |
| > | >
| > | >
| > |
| >
| >
|

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-15-2005
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: <(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: http://www.velocityreviews.com/forums/(E-Mail 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.webcontro ls
| Message-ID: <(E-Mail Removed)>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
| Lines: 354
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontro ls: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/is...s/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=?=" <(E-Mail Removed)>
| | References: <(E-Mail Removed)>
| <(E-Mail Removed)>
| <(E-Mail Removed)>
| <(E-Mail Removed)>
| | 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: <(E-Mail Removed)>
| | 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.webcontro ls
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet.webcontro ls:31062
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
| |
| | 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=?=" <(E-Mail Removed)>
| | > | References: <(E-Mail Removed)>
| | > <(E-Mail Removed)>
| | > | 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: <(E-Mail Removed)>
| | > | 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.webcontro ls
| | > | 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.webcontro ls:31025
| | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
| | > |
| | > | 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=?=" <(E-Mail Removed)>
| | > | > | 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: <(E-Mail Removed)>
| | > | > | 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.webcontro ls
| | > | > | 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.webcontro ls:11764
| | > | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.webcontro ls
| | > | > |
| | > | > | 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?
| | > | > |
| | > | > |
| | > | >
| | > | >
| | > |
| | >
| | >
| |
|
|

 
Reply With Quote
 
s.gregory@4castweb.com
Guest
Posts: n/a
 
      12-08-2005
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?

 
Reply With Quote
 
aaguiar
Guest
Posts: n/a
 
      12-10-2005
Check

http://weblogs.asp.net/aaguiar/articles/432695.aspx

Regards,

Andres

"(E-Mail Removed)" wrote:

> 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?
>
>

 
Reply With Quote
 
last component
Guest
Posts: n/a
 
      12-14-2005
Hi! We support binding at the design time to the typed DtaSets.
http://www.lastcomponent.com/




*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
confused by boost::bind & boost::lambda::bind XHengDF@gmail.com C++ 0 05-29-2007 04:37 AM
Is there a way to bind a simple Table or similar to... =?Utf-8?B?SmF5YnVmZmV0?= ASP .Net 5 02-23-2006 04:06 PM
Finding Server... Finding Host.... enough already!!! Leesa_Tay@softhome.net Computer Support 2 01-20-2006 10:23 AM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM
Easiest way to bind a grid datasource to a datatable =?Utf-8?B?S2VubmV0aA==?= ASP .Net 2 01-18-2004 12:16 PM



Advertisments