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



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=?=" <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: Finding a way to bind ASP.NET controls(two way) to a typed-dat
    ... custom datasource will greatly improve the reusability and flexibility. ... I think that we should let the ObjectDataSource control do less things ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: Finding a way to bind ASP.NET controls(two way) to a typed-dat
    ... datasource control, I think the best means maybe view the .net buildin ... #Simplify UI Development with Custom Designer Actions in Visual Studio ... I think that we should let the ObjectDataSource control do less ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: ObjectDataSource in ASP.NET 2.0
    ... For datasourcecontrol and databindig control, ... it don't quite makesense to maintain such a in-memory reference. ... again from orginal datasource, e.g: ... | Customer customer = new Customer; ...
    (microsoft.public.dotnet.framework.aspnet)
  • CustomDataGrid Child controls event problem - weird!?!
    ... I am trying to build a Custom Web Control that extends the DataGrid control ... firstButton = new ImageButton(); ... private static DataTable dataSourceTable; ... DataSource = dataSourceTable; ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • RE: Finding a way to bind ASP.NET controls(two way) to a typed-dataset
    ... through the new ASP.NET 2.0 Databound control and DataSource control. ... ObjectDataSource, however, currently since the default datasource control ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)

Loading