Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ObjectDataSource method parameters

Reply
Thread Tools

ObjectDataSource method parameters

 
 
J055
Guest
Posts: n/a
 
      11-08-2007
Hi

I've got an update business object method which takes about 80 parameters.
I'm getting the 'could not find a non-generic method' error. I know that the
ObjectDataSource UpdateParameters matches the business object method
signiture. I ran the code below to discover that the InputParameters is in
fact a list of bound values in my FormView control, i.e. not the
UpdateParameters list.

protected void ObjectDataSource_Updating(object sender,
ObjectDataSourceMethodEventArgs e)
{
foreach (DictionaryEntry var in e.InputParameters)
{
Response.Write(var.Key.ToString() + "\n");
}
}

What is the purpose of the UpdateParameters if they don't get used? What am
I doing wrong or what do I need to understand about the ObjectDataSource
when using in this context?

Many thanks
Andrew


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-09-2007
Hi Andrew,

From your description, you're encountering 'could not find a non-generic
method' error when try performing update through ObjectDataSource control,
correct?

As for ObjectDataSource control, though the updateparameters setting will
determine the parameters for update method(and let the runtime identitfy
which method of the object should we use for update), however, the actual
input parameters will depend on the datafields in the databound
control(Gridview, detailsView ....). And for those fields read in select
method(as boundfields), they'll also become a autogenerated parameter in
update method(as old value). For some other behavior, you can refer to the
following msdn doc:

#Using Parameters with the ObjectDataSource Control
http://msdn2.microsoft.com/en-us/library/57hkzhy5.aspx

Also, I suggest you try setting a custom original_parameter string for
ObjectDataSource so that original value will appear in InputParameters
collection as a different naming format:

#ObjectDataSource.OldValuesParameterFormatString Property
http://msdn2.microsoft.com/en-us/lib...rols.objectdat
asource.oldvaluesparameterformatstring.aspx

In addition, if your Object's update method contains large number of
properties, you may consider use Class objecct rather than parameter lists
as update method parameter:

#ObjectDataSource.DataObjectTypeName Property
http://msdn2.microsoft.com/en-us/lib...rols.objectdat
asource.dataobjecttypename.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

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



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


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





--------------------
>From: "J055" <(E-Mail Removed)>
>Subject: ObjectDataSource method parameters
>Date: Thu, 8 Nov 2007 23:50:03 -0000


>Hi
>
>I've got an update business object method which takes about 80 parameters.
>I'm getting the 'could not find a non-generic method' error. I know that

the
>ObjectDataSource UpdateParameters matches the business object method
>signiture. I ran the code below to discover that the InputParameters is in
>fact a list of bound values in my FormView control, i.e. not the
>UpdateParameters list.
>
>protected void ObjectDataSource_Updating(object sender,
>ObjectDataSourceMethodEventArgs e)
>{
> foreach (DictionaryEntry var in e.InputParameters)
> {
> Response.Write(var.Key.ToString() + "\n");
> }
>}
>
>What is the purpose of the UpdateParameters if they don't get used? What

am
>I doing wrong or what do I need to understand about the ObjectDataSource
>when using in this context?
>
>Many thanks
>Andrew
>
>
>


 
Reply With Quote
 
 
 
 
J055
Guest
Posts: n/a
 
      11-13-2007
Hi Steven

I've created an object to use instead of the parameters collection. This is
working much better. I came across the bug which incorrectly formats en-gb
dates as en-us dates. I've managed to add some code to explicitly convert
the strings to dates in the FormView Updating event before the
ObjectDataSourceView calls it's ConvertType method.

I have another question if you don't mind. I have got the form for the
FormView edit template working. As it has a large number of controls I'd
like to share this with the Insert template. The forms essentially contain
the same controls, with a couple of omissions in the Insert mode). It would
make sense to me if I could create a UserControl and then use it in both the
FormView templates. Is this a good idea? I haven't seen any examples. I'm
wondering how much work is required to make sure I can call the necessary
ObjectDataSource and FormView events/methods for example. Do you have any
examples or perhaps you could give me your opinion or any suggestions?

Thanks again
Andrew




"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Andrew,
>
> From your description, you're encountering 'could not find a non-generic
> method' error when try performing update through ObjectDataSource control,
> correct?
>
> As for ObjectDataSource control, though the updateparameters setting will
> determine the parameters for update method(and let the runtime identitfy
> which method of the object should we use for update), however, the actual
> input parameters will depend on the datafields in the databound
> control(Gridview, detailsView ....). And for those fields read in select
> method(as boundfields), they'll also become a autogenerated parameter in
> update method(as old value). For some other behavior, you can refer to the
> following msdn doc:
>
> #Using Parameters with the ObjectDataSource Control
> http://msdn2.microsoft.com/en-us/library/57hkzhy5.aspx
>
> Also, I suggest you try setting a custom original_parameter string for
> ObjectDataSource so that original value will appear in InputParameters
> collection as a different naming format:
>
> #ObjectDataSource.OldValuesParameterFormatString Property
> http://msdn2.microsoft.com/en-us/lib...rols.objectdat
> asource.oldvaluesparameterformatstring.aspx
>
> In addition, if your Object's update method contains large number of
> properties, you may consider use Class objecct rather than parameter lists
> as update method parameter:
>
> #ObjectDataSource.DataObjectTypeName Property
> http://msdn2.microsoft.com/en-us/lib...rols.objectdat
> asource.dataobjecttypename.aspx
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
>
>
> --------------------
>>From: "J055" <(E-Mail Removed)>
>>Subject: ObjectDataSource method parameters
>>Date: Thu, 8 Nov 2007 23:50:03 -0000

>
>>Hi
>>
>>I've got an update business object method which takes about 80 parameters.
>>I'm getting the 'could not find a non-generic method' error. I know that

> the
>>ObjectDataSource UpdateParameters matches the business object method
>>signiture. I ran the code below to discover that the InputParameters is in
>>fact a list of bound values in my FormView control, i.e. not the
>>UpdateParameters list.
>>
>>protected void ObjectDataSource_Updating(object sender,
>>ObjectDataSourceMethodEventArgs e)
>>{
>> foreach (DictionaryEntry var in e.InputParameters)
>> {
>> Response.Write(var.Key.ToString() + "\n");
>> }
>>}
>>
>>What is the purpose of the UpdateParameters if they don't get used? What

> am
>>I doing wrong or what do I need to understand about the ObjectDataSource
>>when using in this context?
>>
>>Many thanks
>>Andrew
>>
>>
>>

>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-14-2007
Hi Andrew,

The new question you mentioned is a good idea. I haven't ever tried it(use
usercontrol as a shared template). However, I do know that you can define a
separate template file (which contains the ascx like markup in it) and
other DataBound control (which use template column) can dynanically
construct the template column by loading the template content from that
separate template file. Here are some articles introducing ASP.NET template
and how to can deal with it(dynamically load it):

#Loading ASP.NET Templates Dynamically
http://www.dotnetheaven.com/UploadFi...5112005005542A
M/DynamicTemplate.aspx?ArticleID=6d76b182-d79f-49a3-99d1-f063bae3a930

#Differences in ASP.NETí»s LoadControl vs. LoadTemplate
http://aspalliance.com/399

#Understanding Templates in ASP.NET
http://msdn.microsoft.com/msdnmag/issues/02/01/cutting/

Hope this also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


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







--------------------
>From: "J055" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
>Subject: Re: ObjectDataSource method parameters
>Date: Tue, 13 Nov 2007 18:34:59 -0000
>
>Hi Steven
>
>I've created an object to use instead of the parameters collection. This

is
>working much better. I came across the bug which incorrectly formats en-gb
>dates as en-us dates. I've managed to add some code to explicitly convert
>the strings to dates in the FormView Updating event before the
>ObjectDataSourceView calls it's ConvertType method.
>
>I have another question if you don't mind. I have got the form for the
>FormView edit template working. As it has a large number of controls I'd
>like to share this with the Insert template. The forms essentially contain
>the same controls, with a couple of omissions in the Insert mode). It

would
>make sense to me if I could create a UserControl and then use it in both

the
>FormView templates. Is this a good idea? I haven't seen any examples. I'm
>wondering how much work is required to make sure I can call the necessary
>ObjectDataSource and FormView events/methods for example. Do you have any
>examples or perhaps you could give me your opinion or any suggestions?
>
>Thanks again
>Andrew
>
>
>


 
Reply With Quote
 
J055
Guest
Posts: n/a
 
      11-18-2007
Hi Steven

Thanks for the articles about template controls. I've managed to get a
FormView to load templates dynamically. However it appears loading controls
this way is not compatable with 2 way databinding. Do you know if this is
possible without a lot of work?

Many thanks
Andrew


"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:UOd%(E-Mail Removed)...
> Hi Andrew,
>
> The new question you mentioned is a good idea. I haven't ever tried it(use
> usercontrol as a shared template). However, I do know that you can define
> a
> separate template file (which contains the ascx like markup in it) and
> other DataBound control (which use template column) can dynanically
> construct the template column by loading the template content from that
> separate template file. Here are some articles introducing ASP.NET
> template
> and how to can deal with it(dynamically load it):
>
> #Loading ASP.NET Templates Dynamically
> http://www.dotnetheaven.com/UploadFi...5112005005542A
> M/DynamicTemplate.aspx?ArticleID=6d76b182-d79f-49a3-99d1-f063bae3a930
>
> #Differences in ASP.NETí»s LoadControl vs. LoadTemplate
> http://aspalliance.com/399
>
> #Understanding Templates in ASP.NET
> http://msdn.microsoft.com/msdnmag/issues/02/01/cutting/
>
> Hope this also helps.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
>
>
>
>
> --------------------
>>From: "J055" <(E-Mail Removed)>
>>References: <(E-Mail Removed)>

> <(E-Mail Removed)>
>>Subject: Re: ObjectDataSource method parameters
>>Date: Tue, 13 Nov 2007 18:34:59 -0000
>>
>>Hi Steven
>>
>>I've created an object to use instead of the parameters collection. This

> is
>>working much better. I came across the bug which incorrectly formats en-gb
>>dates as en-us dates. I've managed to add some code to explicitly convert
>>the strings to dates in the FormView Updating event before the
>>ObjectDataSourceView calls it's ConvertType method.
>>
>>I have another question if you don't mind. I have got the form for the
>>FormView edit template working. As it has a large number of controls I'd
>>like to share this with the Insert template. The forms essentially contain
>>the same controls, with a couple of omissions in the Insert mode). It

> would
>>make sense to me if I could create a UserControl and then use it in both

> the
>>FormView templates. Is this a good idea? I haven't seen any examples. I'm
>>wondering how much work is required to make sure I can call the necessary
>>ObjectDataSource and FormView events/methods for example. Do you have any
>>examples or perhaps you could give me your opinion or any suggestions?
>>
>>Thanks again
>>Andrew
>>
>>
>>

>



 
Reply With Quote
 
J055
Guest
Posts: n/a
 
      12-11-2007
Hi

Just wondered if this thread was still open and if there is any answer to
the question about using a separate template file in a FormView control with
2 way binding. Please see previous posts.

Thanks
Andrew


 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-12-2007
Hi Andrew,

Glad to hear from you. For the previous thread, due to some tool problem, I
haven't seen your last reply and I've manually query the web interface and
see it. So the new problem you meet is that you cannot get two-way
databinding work with dynamically loaded FormView template right?

I have also performed some test on my side and did found the problem
behavior you mentioend. It seems the "Bind" based two-way databinding will
not work(the update parameters are not automatically populated) when the
template is dynamically loaded from an separate file. Currently I'll do
some further research on this to see whether this is expected behavior or
not.

I'll update you as soon as I get any new information.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


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


--------------------
>From: "J055" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
<Ojp#(E-Mail Removed)>
<UOd#(E-Mail Removed)>
<(E-Mail Removed)>
>Subject: Re: ObjectDataSource method parameters
>Date: Tue, 11 Dec 2007 14:32:15 -0000


>Hi
>
>Just wondered if this thread was still open and if there is any answer to
>the question about using a separate template file in a FormView control

with
>2 way binding. Please see previous posts.
>
>Thanks
>Andrew
>
>
>


 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-12-2007
Hi Andrew,

Here is something I've found. This issue does have been recorded since some
other members ever reported it previously. Here is a public web link to the
issue:

https://connect.microsoft.com/Visual...ck.aspx?Feedba
ckID=104085

also, due to some design limitation, it is still unfixed in the latest .net
framework. However, the issue link does provide a workaround, you can visit
the following link to get the idea:

#Dynamically loading an IBindableTemplate
http://www.developerfusion.co.uk/show/4721/

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


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

--------------------
>From: http://www.velocityreviews.com/forums/(E-Mail Removed) (Steven Cheng[MSFT])
>Organization: Microsoft
>Date: Wed, 12 Dec 2007 03:51:40 GMT
>Subject: Re: ObjectDataSource method parameters


>
>Hi Andrew,
>
>Glad to hear from you. For the previous thread, due to some tool problem,

I
>haven't seen your last reply and I've manually query the web interface and
>see it. So the new problem you meet is that you cannot get two-way
>databinding work with dynamically loaded FormView template right?
>
>I have also performed some test on my side and did found the problem
>behavior you mentioend. It seems the "Bind" based two-way databinding will
>not work(the update parameters are not automatically populated) when the
>template is dynamically loaded from an separate file. Currently I'll do
>some further research on this to see whether this is expected behavior or
>not.
>
>I'll update you as soon as I get any new information.
>
>Sincerely,
>
>Steven Cheng
>
>Microsoft MSDN Online Support Lead
>
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>--------------------
>>From: "J055" <(E-Mail Removed)>
>>References: <(E-Mail Removed)>

><(E-Mail Removed)>
><Ojp#(E-Mail Removed)>
><UOd#(E-Mail Removed)>
><(E-Mail Removed)>
>>Subject: Re: ObjectDataSource method parameters
>>Date: Tue, 11 Dec 2007 14:32:15 -0000

>
>>Hi
>>
>>Just wondered if this thread was still open and if there is any answer to
>>the question about using a separate template file in a FormView control

>with
>>2 way binding. Please see previous posts.
>>
>>Thanks
>>Andrew
>>
>>
>>

>
>


 
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
Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'InsertState' that has parameters: UsState, UsStateAbbreviation, StateId. Cirene ASP .Net 0 09-16-2008 11:40 PM
ObjectDataSource & FormView adding two extra paramaters to Update method giving error non-generic method ... Fred Dag ASP .Net 0 09-18-2006 10:36 PM
ObjectDataSource could not find a non-generic method that has parameters ... error yet again Dennis ASP .Net 0 07-01-2006 02:25 AM
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'FillMenusByLocation' that has parameters: @locationId Dotnet Gruven ASP .Net 1 09-14-2005 11:48 AM



Advertisments