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



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=?=" <novus@xxxxxxxxxxxxxxxx>
| 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: <B16DABEE-E0AA-49B7-9F51-782BBA993299@xxxxxxxxxxxxx>
| 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?
|
|

.



Relevant Pages

  • RE: ASPNET2 Radically Changed from v1.1
    ... it use the DataSource control to replace the ( ... generating or configuration datasource control are quite easy.... ... TableAdapter model. ... one typical scenario for using ObjectDataSource is just configure the ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: GridViewRow.DataItem is null
    ... BTW, currently, you'll dynamically create Gridview and DataSource control ... Usercontrol into page, you can dynamically load the usercontrol and add ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: FormView datasource (asp.net 2.0)
    ... Gridview and a FormView control on it. ... wondering a proper approach to make it use querystring value first, ... the Querystring sourced datasource control, otherwise, use the GridView ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Master Page Control in DataSource Select Parameter, 2.0
    ... is it possible to use a control that's on a Master Page ... >> select parameter in a content page's datasource control? ... >> in the VWD Configure Data Source wizard, ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Finding a way to bind ASP.NET controls(two way) to a typed-dat
    ... 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. ... The custom datasource can cache the typed dataset in session. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)