|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Finding a way to bind ASP.NET controls(two way) to a typed-datasettyped-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? 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.) -------------------- Show quoteHide quote | Thread-Topic: Finding a way to bind ASP.NET controls(two way) to a microsoft.public.dotnet.framework.aspnet.webcontrols:11764typed-dataset | thread-index: AcXkbz4CSemtquzmQNyHP9g/A72JUA== | X-WBNR-Posting-Host: 212.187.78.77 | From: "=?Utf-8?B?bm92dXM=?=" <novus@community.nospam> | 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-782BBA993***@microsoft.com> | 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 | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols I’ve | | 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. Show quoteHide quote | 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? | | 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. Show quoteHide quote "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@community.nospam> > | 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-782BBA993***@microsoft.com> > | 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? > | > | > > 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 <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl>typed-dat | thread-index: AcXlFQyGikep/CNAT9+CWDpaOM12kQ== | X-WBNR-Posting-Host: 212.187.78.77 | From: "=?Utf-8?B?bm92dXM=?=" <novus@community.nospam> | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> Show quoteHide quote | Subject: RE: Finding a way to bind ASP.NET controls(two way) to a microsoft.public.dotnet.framework.aspnet.webcontrols:31025typed-dat | Date: Wed, 9 Nov 2005 02:05:01 -0800 | Lines: 149 | Message-ID: <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> | 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 Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols item(record)'s | | 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 Show quoteHide quote | > 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@community.nospam> | > | 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-782BBA993***@microsoft.com> | > | 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? | > | | > | | > | > | 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 Show quoteHide quote "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=?=" <novus@community.nospam> > | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> > <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl> > | 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: <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> > | 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=?=" <novus@community.nospam> > | > | 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-782BBA993***@microsoft.com> > | > | 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? > | > | > | > | > | > > | > > | > > 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 <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl> typed-dat | thread-index: AcXmKLHPy69rEeB5RXKmmvrFt5t70A== | X-WBNR-Posting-Host: 213.73.245.168 | From: "=?Utf-8?B?bm92dXM=?=" <novus@community.nospam> | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> <LaiGlYZ5FHA.3***@TK2MSFTNGXA02.phx.gbl> Show quoteHide quote | Subject: RE: Finding a way to bind ASP.NET controls(two way) to a microsoft.public.dotnet.framework.aspnet.webcontrols:31062typed-dat | Date: Thu, 10 Nov 2005 10:58:10 -0800 | Lines: 274 | Message-ID: <5B1D6C56-0D4E-4E43-AC48-6EB1DEA87***@microsoft.com> | 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 Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols tables on one | | 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 Show quoteHide quote | > WebForm, I have to add three ObjectDataSources to do the job. ¢â‚¬â„¢t | > ================== | > | > 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=?=" <novus@community.nospam> | > | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> | > <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl> | > | 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: <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> | > | 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à Show quoteHide quote | > 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@community.nospam> | > | > | 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-782BBA993***@microsoft.com> | > | > | 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? | > | > | | > | > | | > | > | > | > | > | | > | > | 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 <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl> | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> <LaiGlYZ5FHA.3***@TK2MSFTNGXA02.phx.gbl> <5B1D6C56-0D4E-4E43-AC48-6EB1DEA87***@microsoft.com> | MIME-Version: 1.0 microsoft.public.dotnet.framework.aspnet.webcontrols:31078| Content-Type: text/plain | Content-Transfer-Encoding: 7bit | From: stch***@online.microsoft.com (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: <wZH7SWp5FHA.1***@TK2MSFTNGXA02.phx.gbl> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | Lines: 354 | Path: TK2MSFTNGXA02.phx.gbl | Xref: TK2MSFTNGXA02.phx.gbl Show quoteHide quote | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122 http://msdn.microsoft.com/msdnmag/issues/05/07/DesignerActions/default.aspx| | 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 | Show quoteHide quote | ¢â‚¬â„¢t | #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=?=" <novus@community.nospam> | | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> | <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl> | <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> | <LaiGlYZ5FHA.3***@TK2MSFTNGXA02.phx.gbl> | | 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: <5B1D6C56-0D4E-4E43-AC48-6EB1DEA87***@microsoft.com> | | 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=?=" <novus@community.nospam> | | > | References: <B16DABEE-E0AA-49B7-9F51-782BBA993***@microsoft.com> | | > <nRJaaEO5FHA.3***@TK2MSFTNGXA02.phx.gbl> | | > | 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: <4A0369B6-B645-4723-9B35-2C3211BDA***@microsoft.com> | | > | 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? Show quoteHide quote | | > foul microsoft.public.dotnet.framework.aspnet.webcontrols| | > | 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@community.nospam> | | > | > | 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-782BBA993***@microsoft.com> | | > | > | 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: Show quoteHide quote | | > | > | | | > | > | 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? | | > | > | | | > | > | | | > | > | | > | > | | > | | | > | | > | | | | 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? Check
http://weblogs.asp.net/aaguiar/articles/432695.aspx Regards, Andres Show quoteHide quote "s.greg***@4castweb.com" 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? > > Hi! We support binding at the design time to the typed DtaSets.
http://www.lastcomponent.com/ *** Sent via Developersdex http://www.developersdex.com ***
Error in DataList test query - aspnet 2.0
getting Membership userid to use and store in a custom database Gridview Updates not writing to database after clicking update Datagrid paging I lose my sort Dynamically Adding DataLists Custom DropDownList Control and ListItem Status text FormView DataBinding in Insert mode Hyperlink Control Sorting only certain columns in datagrid |
|||||||||||||||||||||||