Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > objectdatasource

Reply
Thread Tools

objectdatasource

 
 
germ
Guest
Posts: n/a
 
      01-31-2010
I really like the objectdata source with one notable exception.
When doing an update, a new() object is created and the bound values on the
form used to set its properties with all other properties set to default
values.
I would like to be able to override the object creation step and provide a
copy of the original object to be updated such that all values are set not
just those that were bound on the form.

As far as I can tell there is no way to do this - am I missing something and
this is possible ?

Gerry



 
Reply With Quote
 
 
 
 
Thomas Sun [MSFT]
Guest
Posts: n/a
 
      02-01-2010
Hi Gerry,

From your description, I understand that you want to get the copy of
original data and only change the value needed to be changed while updating
with ObjactDataSource control, right? If I have misunderstood you, please
feel free to let me know.

To get original data, you can save it in ViewState in ObjectDataSource's
Selected event and retrieve it in Updating event and then modify it.

For more information, see

http://msdn.microsoft.com/en-us/libr...ols.objectdata
source.updating.aspx
http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
06-cs.aspx


I look forward to receiving your test results.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "germ" <(E-Mail Removed)>
| Subject: objectdatasource
| Date: Sun, 31 Jan 2010 09:31:00 -0500
| Lines: 15
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| Message-ID: <(E-Mail Removed)>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com 206.248.138.28
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:96142
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I really like the objectdata source with one notable exception.
| When doing an update, a new() object is created and the bound values on
the
| form used to set its properties with all other properties set to default
| values.
| I would like to be able to override the object creation step and provide
a
| copy of the original object to be updated such that all values are set
not
| just those that were bound on the form.
|
| As far as I can tell there is no way to do this - am I missing something
and
| this is possible ?
|
| Gerry
|
|
|
|


 
Reply With Quote
 
 
 
 
germ
Guest
Posts: n/a
 
      02-01-2010
Thanks Thomas,

This seems to work fine under the specific ODS configuration given in the
example.
However, in cases where multiple forms each update a different subset of
properties on the same data object, we are forced to setup an update method
specific to each form. I would prefer to configure the ODS on each form
with the DataObjectTypeName to all invoke the same update method which takes
the updated data object as its only argument .
In this scenario, you can't modifiy the InputParameters in the Updating
event - it generates the runtime error : System.NotSupportedException: The
OrderedDictionary is readonly and cannot be modified.
But this is moot anyway because the new object has already been created and
populated before this point.

I am thinking that this will involve a custom ObjectDataSource. I may either
try to track down the source for the ODS or use relector to see if deriving
from the standard ODS is possible.

Gerry




"Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Gerry,
>
> From your description, I understand that you want to get the copy of
> original data and only change the value needed to be changed while
> updating
> with ObjactDataSource control, right? If I have misunderstood you, please
> feel free to let me know.
>
> To get original data, you can save it in ViewState in ObjectDataSource's
> Selected event and retrieve it in Updating event and then modify it.
>
> For more information, see
>
> http://msdn.microsoft.com/en-us/libr...ols.objectdata
> source.updating.aspx
> http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
> 06-cs.aspx
>
>
> I look forward to receiving your test results.
>
>
> --
> Best Regards,
> Thomas Sun
>
> Microsoft Online Partner Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
> to the limited number of phone-based technical support incidents. Complex
> issues or server-down situations are not recommended for the newsgroups.
> Issues of this nature are best handled working with a Microsoft Support
> Engineer using one of your phone-based incidents.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> --------------------
> | From: "germ" <(E-Mail Removed)>
> | Subject: objectdatasource
> | Date: Sun, 31 Jan 2010 09:31:00 -0500
> | Lines: 15
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
> | X-RFC2646: Format=Flowed; Original
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
> | Message-ID: <(E-Mail Removed)>
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com 206.248.138.28
> | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
> | Xref: TK2MSFTNGHUB02.phx.gbl
> microsoft.public.dotnet.framework.aspnet:96142
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | I really like the objectdata source with one notable exception.
> | When doing an update, a new() object is created and the bound values on
> the
> | form used to set its properties with all other properties set to default
> | values.
> | I would like to be able to override the object creation step and provide
> a
> | copy of the original object to be updated such that all values are set
> not
> | just those that were bound on the form.
> |
> | As far as I can tell there is no way to do this - am I missing something
> and
> | this is possible ?
> |
> | Gerry
> |
> |
> |
> |
>
>



 
Reply With Quote
 
germ
Guest
Posts: n/a
 
      02-01-2010
well after my 1st major foray into reflection I have this working as
desired.
In the end I derived classes from ObjectDataSource and ObjectDataSourceView,
there was minor change to the ObjectDataSource constructor and a slightly
more involved change to the ObjectDataSourceView.ExecuteUpdate() method.
Luckily these 2 classes have minimal security settings to allow reflected
access to private members.

Now the question is - can I globally specifiy that any references to
System.Web.UI.WebControls.ObjectDataSource should instead use
Some.Other.ObjectDataSource ?
I seem to recall seeing this type of thing being done in the web.config in
the past for previews & betas - I can't find an example but I have the
feeling this was at the assembly level and I only want to replace a single
control.

Gerry




"germ" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thanks Thomas,
>
> This seems to work fine under the specific ODS configuration given in the
> example.
> However, in cases where multiple forms each update a different subset of
> properties on the same data object, we are forced to setup an update
> method specific to each form. I would prefer to configure the ODS on each
> form with the DataObjectTypeName to all invoke the same update method
> which takes the updated data object as its only argument .
> In this scenario, you can't modifiy the InputParameters in the Updating
> event - it generates the runtime error : System.NotSupportedException: The
> OrderedDictionary is readonly and cannot be modified.
> But this is moot anyway because the new object has already been created
> and populated before this point.
>
> I am thinking that this will involve a custom ObjectDataSource. I may
> either try to track down the source for the ODS or use relector to see if
> deriving from the standard ODS is possible.
>
> Gerry
>
>
>
>
> "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi Gerry,
>>
>> From your description, I understand that you want to get the copy of
>> original data and only change the value needed to be changed while
>> updating
>> with ObjactDataSource control, right? If I have misunderstood you, please
>> feel free to let me know.
>>
>> To get original data, you can save it in ViewState in ObjectDataSource's
>> Selected event and retrieve it in Updating event and then modify it.
>>
>> For more information, see
>>
>> http://msdn.microsoft.com/en-us/libr...ols.objectdata
>> source.updating.aspx
>> http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
>> 06-cs.aspx
>>
>>
>> I look forward to receiving your test results.
>>
>>
>> --
>> Best Regards,
>> Thomas Sun
>>
>> Microsoft Online Partner Support
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>> http://msdn.microsoft.com/subscripti...ult.aspx#notif
>> ications.
>>
>> With newsgroups, MSDN subscribers enjoy unlimited, free support as
>> opposed
>> to the limited number of phone-based technical support incidents. Complex
>> issues or server-down situations are not recommended for the newsgroups.
>> Issues of this nature are best handled working with a Microsoft Support
>> Engineer using one of your phone-based incidents.
>> ==================================================
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> --------------------
>> | From: "germ" <(E-Mail Removed)>
>> | Subject: objectdatasource
>> | Date: Sun, 31 Jan 2010 09:31:00 -0500
>> | Lines: 15
>> | X-Priority: 3
>> | X-MSMail-Priority: Normal
>> | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
>> | X-RFC2646: Format=Flowed; Original
>> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
>> | Message-ID: <(E-Mail Removed)>
>> | Newsgroups: microsoft.public.dotnet.framework.aspnet
>> | NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com 206.248.138.28
>> | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
>> | Xref: TK2MSFTNGHUB02.phx.gbl
>> microsoft.public.dotnet.framework.aspnet:96142
>> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>> |
>> | I really like the objectdata source with one notable exception.
>> | When doing an update, a new() object is created and the bound values on
>> the
>> | form used to set its properties with all other properties set to
>> default
>> | values.
>> | I would like to be able to override the object creation step and
>> provide
>> a
>> | copy of the original object to be updated such that all values are set
>> not
>> | just those that were bound on the form.
>> |
>> | As far as I can tell there is no way to do this - am I missing
>> something
>> and
>> | this is possible ?
>> |
>> | Gerry
>> |
>> |
>> |
>> |
>>
>>

>
>



 
Reply With Quote
 
Thomas Sun [MSFT]
Guest
Posts: n/a
 
      02-02-2010
Hi Gerry,

Thanks for your response. I am glad that you worked it out.

To globally use your custom ObjectDataSource control, we can register it in
web.config's Controls section and then use this custom ObjectDataSoure in
page. For example:
======================
<pages>
<controls>
<add assembly="CustomObjectDataSource"
namespace="CustomObjectDataSource" tagPrefix="cc1"/>
</controls>
</pages>
======================

You can also add this custom ObjectDataSource into Toolbox so that you can
drag and drop it into page like other server control.

For more information, see
http://weblogs.asp.net/scottgu/archi...w-to-register-
user-controls-and-custom-controls-in-web-config.aspx
http://msdn.microsoft.com/en-us/library/1e9b4c9f.aspx


I look forward to receiving your test results.



Best Regards,
Thomas Sun

Microsoft Online Partner Support
--------------------|
| well after my 1st major foray into reflection I have this working as
| desired.
| In the end I derived classes from ObjectDataSource and
ObjectDataSourceView,
| there was minor change to the ObjectDataSource constructor and a slightly
| more involved change to the ObjectDataSourceView.ExecuteUpdate() method.
| Luckily these 2 classes have minimal security settings to allow reflected
| access to private members.
|
| Now the question is - can I globally specifiy that any references to
| System.Web.UI.WebControls.ObjectDataSource should instead use
| Some.Other.ObjectDataSource ?
| I seem to recall seeing this type of thing being done in the web.config
in
| the past for previews & betas - I can't find an example but I have the
| feeling this was at the assembly level and I only want to replace a
single
| control.
|
| Gerry
|
|
|
|
| "germ" <(E-Mail Removed)> wrote in message
| news:%(E-Mail Removed)...
| > Thanks Thomas,
| >
| > This seems to work fine under the specific ODS configuration given in
the
| > example.
| > However, in cases where multiple forms each update a different subset
of
| > properties on the same data object, we are forced to setup an update
| > method specific to each form. I would prefer to configure the ODS on
each
| > form with the DataObjectTypeName to all invoke the same update method
| > which takes the updated data object as its only argument .
| > In this scenario, you can't modifiy the InputParameters in the Updating
| > event - it generates the runtime error : System.NotSupportedException:
The
| > OrderedDictionary is readonly and cannot be modified.
| > But this is moot anyway because the new object has already been created
| > and populated before this point.
| >
| > I am thinking that this will involve a custom ObjectDataSource. I may
| > either try to track down the source for the ODS or use relector to see
if
| > deriving from the standard ODS is possible.
| >
| > Gerry
| >
| >
| >
| >
| > "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
| > news:(E-Mail Removed)...
| >> Hi Gerry,
| >>
| >> From your description, I understand that you want to get the copy of
| >> original data and only change the value needed to be changed while
| >> updating
| >> with ObjactDataSource control, right? If I have misunderstood you,
please
| >> feel free to let me know.
| >>
| >> To get original data, you can save it in ViewState in
ObjectDataSource's
| >> Selected event and retrieve it in Updating event and then modify it.
| >>
| >> For more information, see
| >>
| >>
http://msdn.microsoft.com/en-us/libr...ols.objectdata
| >> source.updating.aspx
| >>
http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
| >> 06-cs.aspx
| >>
| >>
| >> I look forward to receiving your test results.
| >>
| >>
| >> --
| >> Best Regards,
| >> Thomas Sun
| >>
| >> Microsoft Online Partner Support
| >>
| >> ==================================================
| >> Get notification to my posts through email? Please refer to
| >>
http://msdn.microsoft.com/subscripti...ult.aspx#notif
| >> ications.
| >>
| >> With newsgroups, MSDN subscribers enjoy unlimited, free support as
| >> opposed
| >> to the limited number of phone-based technical support incidents.
Complex
| >> issues or server-down situations are not recommended for the
newsgroups.
| >> Issues of this nature are best handled working with a Microsoft Support
| >> Engineer using one of your phone-based incidents.
| >> ==================================================
| >>
| >> This posting is provided "AS IS" with no warranties, and confers no
| >> rights.
| >>
| >> --------------------
| >> | From: "germ" <(E-Mail Removed)>
| >> | Subject: objectdatasource
| >> | Date: Sun, 31 Jan 2010 09:31:00 -0500
| >> | Lines: 15
| >> | X-Priority: 3
| >> | X-MSMail-Priority: Normal
| >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
| >> | X-RFC2646: Format=Flowed; Original
| >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| >> | Message-ID: <(E-Mail Removed)>
| >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| >> | NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com 206.248.138.28
| >> | Path:
TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
| >> | Xref: TK2MSFTNGHUB02.phx.gbl
| >> microsoft.public.dotnet.framework.aspnet:96142
| >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| >> |
| >> | I really like the objectdata source with one notable exception.
| >> | When doing an update, a new() object is created and the bound values
on
| >> the
| >> | form used to set its properties with all other properties set to
| >> default
| >> | values.
| >> | I would like to be able to override the object creation step and
| >> provide
| >> a
| >> | copy of the original object to be updated such that all values are
set
| >> not
| >> | just those that were bound on the form.
| >> |
| >> | As far as I can tell there is no way to do this - am I missing
| >> something
| >> and
| >> | this is possible ?
| >> |
| >> | Gerry
| >> |
| >> |
| >> |
| >> |
| >>
| >>
| >
| >
|
|
|

 
Reply With Quote
 
germ
Guest
Posts: n/a
 
      02-02-2010
thanks thomas

I did this same web.config mod and I added a control adapter for the
ObjectDataSource that will throw an exception at runtime if the control is
not an isntance of my custom version.

Gerry





"Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Gerry,
>
> Thanks for your response. I am glad that you worked it out.
>
> To globally use your custom ObjectDataSource control, we can register it
> in
> web.config's Controls section and then use this custom ObjectDataSoure in
> page. For example:
> ======================
> <pages>
> <controls>
> <add assembly="CustomObjectDataSource"
> namespace="CustomObjectDataSource" tagPrefix="cc1"/>
> </controls>
> </pages>
> ======================
>
> You can also add this custom ObjectDataSource into Toolbox so that you can
> drag and drop it into page like other server control.
>
> For more information, see
> http://weblogs.asp.net/scottgu/archi...w-to-register-
> user-controls-and-custom-controls-in-web-config.aspx
> http://msdn.microsoft.com/en-us/library/1e9b4c9f.aspx
>
>
> I look forward to receiving your test results.
>
>
>
> Best Regards,
> Thomas Sun
>
> Microsoft Online Partner Support
> --------------------|
> | well after my 1st major foray into reflection I have this working as
> | desired.
> | In the end I derived classes from ObjectDataSource and
> ObjectDataSourceView,
> | there was minor change to the ObjectDataSource constructor and a
> slightly
> | more involved change to the ObjectDataSourceView.ExecuteUpdate() method.
> | Luckily these 2 classes have minimal security settings to allow
> reflected
> | access to private members.
> |
> | Now the question is - can I globally specifiy that any references to
> | System.Web.UI.WebControls.ObjectDataSource should instead use
> | Some.Other.ObjectDataSource ?
> | I seem to recall seeing this type of thing being done in the web.config
> in
> | the past for previews & betas - I can't find an example but I have the
> | feeling this was at the assembly level and I only want to replace a
> single
> | control.
> |
> | Gerry
> |
> |
> |
> |
> | "germ" <(E-Mail Removed)> wrote in message
> | news:%(E-Mail Removed)...
> | > Thanks Thomas,
> | >
> | > This seems to work fine under the specific ODS configuration given in
> the
> | > example.
> | > However, in cases where multiple forms each update a different subset
> of
> | > properties on the same data object, we are forced to setup an update
> | > method specific to each form. I would prefer to configure the ODS on
> each
> | > form with the DataObjectTypeName to all invoke the same update method
> | > which takes the updated data object as its only argument .
> | > In this scenario, you can't modifiy the InputParameters in the
> Updating
> | > event - it generates the runtime error : System.NotSupportedException:
> The
> | > OrderedDictionary is readonly and cannot be modified.
> | > But this is moot anyway because the new object has already been
> created
> | > and populated before this point.
> | >
> | > I am thinking that this will involve a custom ObjectDataSource. I may
> | > either try to track down the source for the ODS or use relector to see
> if
> | > deriving from the standard ODS is possible.
> | >
> | > Gerry
> | >
> | >
> | >
> | >
> | > "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
> | > news:(E-Mail Removed)...
> | >> Hi Gerry,
> | >>
> | >> From your description, I understand that you want to get the copy of
> | >> original data and only change the value needed to be changed while
> | >> updating
> | >> with ObjactDataSource control, right? If I have misunderstood you,
> please
> | >> feel free to let me know.
> | >>
> | >> To get original data, you can save it in ViewState in
> ObjectDataSource's
> | >> Selected event and retrieve it in Updating event and then modify it.
> | >>
> | >> For more information, see
> | >>
> | >>
> http://msdn.microsoft.com/en-us/libr...ols.objectdata
> | >> source.updating.aspx
> | >>
> http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
> | >> 06-cs.aspx
> | >>
> | >>
> | >> I look forward to receiving your test results.
> | >>
> | >>
> | >> --
> | >> Best Regards,
> | >> Thomas Sun
> | >>
> | >> Microsoft Online Partner Support
> | >>
> | >> ==================================================
> | >> Get notification to my posts through email? Please refer to
> | >>
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> | >> ications.
> | >>
> | >> With newsgroups, MSDN subscribers enjoy unlimited, free support as
> | >> opposed
> | >> to the limited number of phone-based technical support incidents.
> Complex
> | >> issues or server-down situations are not recommended for the
> newsgroups.
> | >> Issues of this nature are best handled working with a Microsoft
> Support
> | >> Engineer using one of your phone-based incidents.
> | >> ==================================================
> | >>
> | >> This posting is provided "AS IS" with no warranties, and confers no
> | >> rights.
> | >>
> | >> --------------------
> | >> | From: "germ" <(E-Mail Removed)>
> | >> | Subject: objectdatasource
> | >> | Date: Sun, 31 Jan 2010 09:31:00 -0500
> | >> | Lines: 15
> | >> | X-Priority: 3
> | >> | X-MSMail-Priority: Normal
> | >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
> | >> | X-RFC2646: Format=Flowed; Original
> | >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
> | >> | Message-ID: <(E-Mail Removed)>
> | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | >> | NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com 206.248.138.28
> | >> | Path:
> TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
> | >> | Xref: TK2MSFTNGHUB02.phx.gbl
> | >> microsoft.public.dotnet.framework.aspnet:96142
> | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> | >> |
> | >> | I really like the objectdata source with one notable exception.
> | >> | When doing an update, a new() object is created and the bound
> values
> on
> | >> the
> | >> | form used to set its properties with all other properties set to
> | >> default
> | >> | values.
> | >> | I would like to be able to override the object creation step and
> | >> provide
> | >> a
> | >> | copy of the original object to be updated such that all values are
> set
> | >> not
> | >> | just those that were bound on the form.
> | >> |
> | >> | As far as I can tell there is no way to do this - am I missing
> | >> something
> | >> and
> | >> | this is possible ?
> | >> |
> | >> | Gerry
> | >> |
> | >> |
> | >> |
> | >> |
> | >>
> | >>
> | >
> | >
> |
> |
> |
>



 
Reply With Quote
 
Thomas Sun [MSFT]
Guest
Posts: n/a
 
      02-03-2010
Hi Gerry,

Where did you get the error message? The error message means that you are
trying to use an Object which is not set to an instance.

Since this control is custom ASP.NET server control, please ensure its
Namespace and Class Name is correct in register syntax in web.config.

Besides, you can send me an example which can reproduce the issue. My email
address is http://www.velocityreviews.com/forums/(E-Mail Removed)

I look forward to hearing from you.

--

Best Regards,
Thomas Sun

Microsoft Online Partner Support

--------------------
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| thanks thomas
|
| I did this same web.config mod and I added a control adapter for the
| ObjectDataSource that will throw an exception at runtime if the control
is
| not an isntance of my custom version.
|
| Gerry
|
|
|
|
|
| "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
| news:(E-Mail Removed)...
| > Hi Gerry,
| >
| > Thanks for your response. I am glad that you worked it out.
| >
| > To globally use your custom ObjectDataSource control, we can register
it
| > in
| > web.config's Controls section and then use this custom ObjectDataSoure
in
| > page. For example:
| > ======================
| > <pages>
| > <controls>
| > <add assembly="CustomObjectDataSource"
| > namespace="CustomObjectDataSource" tagPrefix="cc1"/>
| > </controls>
| > </pages>
| > ======================
| >
| > You can also add this custom ObjectDataSource into Toolbox so that you
can
| > drag and drop it into page like other server control.
| >
| > For more information, see
| >
http://weblogs.asp.net/scottgu/archi...w-to-register-
| > user-controls-and-custom-controls-in-web-config.aspx
| > http://msdn.microsoft.com/en-us/library/1e9b4c9f.aspx
| >
| >
| > I look forward to receiving your test results.
| >
| >
| >
| > Best Regards,
| > Thomas Sun
| >
| > Microsoft Online Partner Support
| > --------------------|
| > | well after my 1st major foray into reflection I have this working as
| > | desired.
| > | In the end I derived classes from ObjectDataSource and
| > ObjectDataSourceView,
| > | there was minor change to the ObjectDataSource constructor and a
| > slightly
| > | more involved change to the ObjectDataSourceView.ExecuteUpdate()
method.
| > | Luckily these 2 classes have minimal security settings to allow
| > reflected
| > | access to private members.
| > |
| > | Now the question is - can I globally specifiy that any references to
| > | System.Web.UI.WebControls.ObjectDataSource should instead use
| > | Some.Other.ObjectDataSource ?
| > | I seem to recall seeing this type of thing being done in the
web.config
| > in
| > | the past for previews & betas - I can't find an example but I have the
| > | feeling this was at the assembly level and I only want to replace a
| > single
| > | control.
| > |
| > | Gerry
| > |
| > |
| > |
| > |
| > | "germ" <(E-Mail Removed)> wrote in message
| > | news:%(E-Mail Removed)...
| > | > Thanks Thomas,
| > | >
| > | > This seems to work fine under the specific ODS configuration given
in
| > the
| > | > example.
| > | > However, in cases where multiple forms each update a different
subset
| > of
| > | > properties on the same data object, we are forced to setup an update
| > | > method specific to each form. I would prefer to configure the ODS
on
| > each
| > | > form with the DataObjectTypeName to all invoke the same update
method
| > | > which takes the updated data object as its only argument .
| > | > In this scenario, you can't modifiy the InputParameters in the
| > Updating
| > | > event - it generates the runtime error :
System.NotSupportedException:
| > The
| > | > OrderedDictionary is readonly and cannot be modified.
| > | > But this is moot anyway because the new object has already been
| > created
| > | > and populated before this point.
| > | >
| > | > I am thinking that this will involve a custom ObjectDataSource. I
may
| > | > either try to track down the source for the ODS or use relector to
see
| > if
| > | > deriving from the standard ODS is possible.
| > | >
| > | > Gerry
| > | >
| > | >
| > | >
| > | >
| > | > "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
| > | > news:(E-Mail Removed)...
| > | >> Hi Gerry,
| > | >>
| > | >> From your description, I understand that you want to get the copy
of
| > | >> original data and only change the value needed to be changed while
| > | >> updating
| > | >> with ObjactDataSource control, right? If I have misunderstood you,
| > please
| > | >> feel free to let me know.
| > | >>
| > | >> To get original data, you can save it in ViewState in
| > ObjectDataSource's
| > | >> Selected event and retrieve it in Updating event and then modify
it.
| > | >>
| > | >> For more information, see
| > | >>
| > | >>
| >
http://msdn.microsoft.com/en-us/libr...ols.objectdata
| > | >> source.updating.aspx
| > | >>
| >
http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
| > | >> 06-cs.aspx
| > | >>
| > | >>
| > | >> I look forward to receiving your test results.
| > | >>
| > | >>
| > | >> --
| > | >> Best Regards,
| > | >> Thomas Sun
| > | >>
| > | >> Microsoft Online Partner Support
| > | >>
| > | >> ==================================================
| > | >> Get notification to my posts through email? Please refer to
| > | >>
| >
http://msdn.microsoft.com/subscripti...ult.aspx#notif
| > | >> ications.
| > | >>
| > | >> With newsgroups, MSDN subscribers enjoy unlimited, free support as
| > | >> opposed
| > | >> to the limited number of phone-based technical support incidents.
| > Complex
| > | >> issues or server-down situations are not recommended for the
| > newsgroups.
| > | >> Issues of this nature are best handled working with a Microsoft
| > Support
| > | >> Engineer using one of your phone-based incidents.
| > | >> ==================================================
| > | >>
| > | >> This posting is provided "AS IS" with no warranties, and confers no
| > | >> rights.
| > | >>
| > | >> --------------------
| > | >> | From: "germ" <(E-Mail Removed)>
| > | >> | Subject: objectdatasource
| > | >> | Date: Sun, 31 Jan 2010 09:31:00 -0500
| > | >> | Lines: 15
| > | >> | X-Priority: 3
| > | >> | X-MSMail-Priority: Normal
| > | >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
| > | >> | X-RFC2646: Format=Flowed; Original
| > | >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| > | >> | Message-ID: <(E-Mail Removed)>
| > | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | >> | NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com 206.248.138.28
| > | >> | Path:
| > TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
| > | >> | Xref: TK2MSFTNGHUB02.phx.gbl
| > | >> microsoft.public.dotnet.framework.aspnet:96142
| > | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | >> |
| > | >> | I really like the objectdata source with one notable exception.
| > | >> | When doing an update, a new() object is created and the bound
| > values
| > on
| > | >> the
| > | >> | form used to set its properties with all other properties set to
| > | >> default
| > | >> | values.
| > | >> | I would like to be able to override the object creation step and
| > | >> provide
| > | >> a
| > | >> | copy of the original object to be updated such that all values
are
| > set
| > | >> not
| > | >> | just those that were bound on the form.
| > | >> |
| > | >> | As far as I can tell there is no way to do this - am I missing
| > | >> something
| > | >> and
| > | >> | this is possible ?
| > | >> |
| > | >> | Gerry
| > | >> |
| > | >> |
| > | >> |
| > | >> |
| > | >>
| > | >>
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|


 
Reply With Quote
 
germ
Guest
Posts: n/a
 
      02-03-2010
i don't.

What I said was that I created a control adapter for the objectdatasource
that will throw an exception at runtime if I use the standard ODS somewhere
on my site rather ths using my custom version.
The idea here is that I want to ensure that I always use my control as the
DAL update methods are depending on the enhanced 'fully populated objects'
ODS functionality.






"Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Gerry,
>
> Where did you get the error message? The error message means that you are
> trying to use an Object which is not set to an instance.
>
> Since this control is custom ASP.NET server control, please ensure its
> Namespace and Class Name is correct in register syntax in web.config.
>
> Besides, you can send me an example which can reproduce the issue. My
> email
> address is (E-Mail Removed)
>
> I look forward to hearing from you.
>
> --
>
> Best Regards,
> Thomas Sun
>
> Microsoft Online Partner Support
>
> --------------------
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | thanks thomas
> |
> | I did this same web.config mod and I added a control adapter for the
> | ObjectDataSource that will throw an exception at runtime if the control
> is
> | not an isntance of my custom version.
> |
> | Gerry
> |
> |
> |
> |
> |
> | "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in message
> | news:(E-Mail Removed)...
> | > Hi Gerry,
> | >
> | > Thanks for your response. I am glad that you worked it out.
> | >
> | > To globally use your custom ObjectDataSource control, we can register
> it
> | > in
> | > web.config's Controls section and then use this custom ObjectDataSoure
> in
> | > page. For example:
> | > ======================
> | > <pages>
> | > <controls>
> | > <add assembly="CustomObjectDataSource"
> | > namespace="CustomObjectDataSource" tagPrefix="cc1"/>
> | > </controls>
> | > </pages>
> | > ======================
> | >
> | > You can also add this custom ObjectDataSource into Toolbox so that you
> can
> | > drag and drop it into page like other server control.
> | >
> | > For more information, see
> | >
> http://weblogs.asp.net/scottgu/archi...w-to-register-
> | > user-controls-and-custom-controls-in-web-config.aspx
> | > http://msdn.microsoft.com/en-us/library/1e9b4c9f.aspx
> | >
> | >
> | > I look forward to receiving your test results.
> | >
> | >
> | >
> | > Best Regards,
> | > Thomas Sun
> | >
> | > Microsoft Online Partner Support
> | > --------------------|
> | > | well after my 1st major foray into reflection I have this working as
> | > | desired.
> | > | In the end I derived classes from ObjectDataSource and
> | > ObjectDataSourceView,
> | > | there was minor change to the ObjectDataSource constructor and a
> | > slightly
> | > | more involved change to the ObjectDataSourceView.ExecuteUpdate()
> method.
> | > | Luckily these 2 classes have minimal security settings to allow
> | > reflected
> | > | access to private members.
> | > |
> | > | Now the question is - can I globally specifiy that any references to
> | > | System.Web.UI.WebControls.ObjectDataSource should instead use
> | > | Some.Other.ObjectDataSource ?
> | > | I seem to recall seeing this type of thing being done in the
> web.config
> | > in
> | > | the past for previews & betas - I can't find an example but I have
> the
> | > | feeling this was at the assembly level and I only want to replace a
> | > single
> | > | control.
> | > |
> | > | Gerry
> | > |
> | > |
> | > |
> | > |
> | > | "germ" <(E-Mail Removed)> wrote in message
> | > | news:%(E-Mail Removed)...
> | > | > Thanks Thomas,
> | > | >
> | > | > This seems to work fine under the specific ODS configuration given
> in
> | > the
> | > | > example.
> | > | > However, in cases where multiple forms each update a different
> subset
> | > of
> | > | > properties on the same data object, we are forced to setup an
> update
> | > | > method specific to each form. I would prefer to configure the ODS
> on
> | > each
> | > | > form with the DataObjectTypeName to all invoke the same update
> method
> | > | > which takes the updated data object as its only argument .
> | > | > In this scenario, you can't modifiy the InputParameters in the
> | > Updating
> | > | > event - it generates the runtime error :
> System.NotSupportedException:
> | > The
> | > | > OrderedDictionary is readonly and cannot be modified.
> | > | > But this is moot anyway because the new object has already been
> | > created
> | > | > and populated before this point.
> | > | >
> | > | > I am thinking that this will involve a custom ObjectDataSource. I
> may
> | > | > either try to track down the source for the ODS or use relector to
> see
> | > if
> | > | > deriving from the standard ODS is possible.
> | > | >
> | > | > Gerry
> | > | >
> | > | >
> | > | >
> | > | >
> | > | > "Thomas Sun [MSFT]" <(E-Mail Removed)> wrote in
> message
> | > | > news:(E-Mail Removed)...
> | > | >> Hi Gerry,
> | > | >>
> | > | >> From your description, I understand that you want to get the copy
> of
> | > | >> original data and only change the value needed to be changed
> while
> | > | >> updating
> | > | >> with ObjactDataSource control, right? If I have misunderstood
> you,
> | > please
> | > | >> feel free to let me know.
> | > | >>
> | > | >> To get original data, you can save it in ViewState in
> | > ObjectDataSource's
> | > | >> Selected event and retrieve it in Updating event and then modify
> it.
> | > | >>
> | > | >> For more information, see
> | > | >>
> | > | >>
> | >
> http://msdn.microsoft.com/en-us/libr...ols.objectdata
> | > | >> source.updating.aspx
> | > | >>
> | >
> http://www.asp.net/(S(ywiyuluxr3qb2d...cess/tutorial-
> | > | >> 06-cs.aspx
> | > | >>
> | > | >>
> | > | >> I look forward to receiving your test results.
> | > | >>
> | > | >>
> | > | >> --
> | > | >> Best Regards,
> | > | >> Thomas Sun
> | > | >>
> | > | >> Microsoft Online Partner Support
> | > | >>
> | > | >> ==================================================
> | > | >> Get notification to my posts through email? Please refer to
> | > | >>
> | >
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> | > | >> ications.
> | > | >>
> | > | >> With newsgroups, MSDN subscribers enjoy unlimited, free support
> as
> | > | >> opposed
> | > | >> to the limited number of phone-based technical support incidents.
> | > Complex
> | > | >> issues or server-down situations are not recommended for the
> | > newsgroups.
> | > | >> Issues of this nature are best handled working with a Microsoft
> | > Support
> | > | >> Engineer using one of your phone-based incidents.
> | > | >> ==================================================
> | > | >>
> | > | >> This posting is provided "AS IS" with no warranties, and confers
> no
> | > | >> rights.
> | > | >>
> | > | >> --------------------
> | > | >> | From: "germ" <(E-Mail Removed)>
> | > | >> | Subject: objectdatasource
> | > | >> | Date: Sun, 31 Jan 2010 09:31:00 -0500
> | > | >> | Lines: 15
> | > | >> | X-Priority: 3
> | > | >> | X-MSMail-Priority: Normal
> | > | >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
> | > | >> | X-RFC2646: Format=Flowed; Original
> | > | >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
> | > | >> | Message-ID: <(E-Mail Removed)>
> | > | >> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | > | >> | NNTP-Posting-Host: 206-248-138-28.dsl.teksavvy.com
> 206.248.138.28
> | > | >> | Path:
> | > TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP02.phx.gbl
> | > | >> | Xref: TK2MSFTNGHUB02.phx.gbl
> | > | >> microsoft.public.dotnet.framework.aspnet:96142
> | > | >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> | > | >> |
> | > | >> | I really like the objectdata source with one notable exception.
> | > | >> | When doing an update, a new() object is created and the bound
> | > values
> | > on
> | > | >> the
> | > | >> | form used to set its properties with all other properties set
> to
> | > | >> default
> | > | >> | values.
> | > | >> | I would like to be able to override the object creation step
> and
> | > | >> provide
> | > | >> a
> | > | >> | copy of the original object to be updated such that all values
> are
> | > set
> | > | >> not
> | > | >> | just those that were bound on the form.
> | > | >> |
> | > | >> | As far as I can tell there is no way to do this - am I missing
> | > | >> something
> | > | >> and
> | > | >> | this is possible ?
> | > | >> |
> | > | >> | Gerry
> | > | >> |
> | > | >> |
> | > | >> |
> | > | >> |
> | > | >>
> | > | >>
> | > | >
> | > | >
> | > |
> | > |
> | > |
> | >
> |
> |
> |
>
>



 
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
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
HELP !!! ObjectDataSource Delete Parameter Problem ASP.NET 2.0 Microsoft news ASP .Net 2 03-16-2005 05:37 PM
ObjectDataSource =?Utf-8?B?RG9u?= ASP .Net 0 11-22-2004 08:21 PM
Arrrrg !!!! ObjectDataSource Issues WertmanTheMad ASP .Net 2 10-08-2004 04:10 PM
objectDataSource WertmanTheMad ASP .Net 0 09-15-2004 03:37 AM



Advertisments