473,807 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ObjectDataSourc e method parameters

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
ObjectDataSourc e UpdateParameter s 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
UpdateParameter s list.

protected void ObjectDataSourc e_Updating(obje ct sender,
ObjectDataSourc eMethodEventArg s e)
{
foreach (DictionaryEntr y var in e.InputParamete rs)
{
Response.Write( var.Key.ToStrin g() + "\n");
}
}

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

Many thanks
Andrew
Nov 8 '07 #1
5 3216
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" <j0**@newsgroup s.nospam>
References: <uw************ **@TK2MSFTNGP03 .phx.gbl>
<vj************ *@TK2MSFTNGHUB0 2.phx.gbl>
>Subject: Re: ObjectDataSourc e 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
ObjectDataSour ceView 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
ObjectDataSour ce 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
Nov 14 '07 #2
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]" <st*****@online .microsoft.comw rote in message
news:UO******** ********@TK2MSF TNGHUB02.phx.gb l...
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" <j0**@newsgroup s.nospam>
References: <uw************ **@TK2MSFTNGP03 .phx.gbl>
<vj************ *@TK2MSFTNGHUB0 2.phx.gbl>
>>Subject: Re: ObjectDataSourc e 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
ObjectDataSou rceView 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
ObjectDataSou rce 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

Nov 18 '07 #3
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
Dec 11 '07 #4
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" <j0**@newsgroup s.nospam>
References: <uw************ **@TK2MSFTNGP03 .phx.gbl>
<vj************ *@TK2MSFTNGHUB0 2.phx.gbl>
<Oj************ **@TK2MSFTNGP02 .phx.gbl>
<UO************ **@TK2MSFTNGHUB 02.phx.gbl>
<ui************ **@TK2MSFTNGP02 .phx.gbl>
>Subject: Re: ObjectDataSourc e 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
Dec 12 '07 #5
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 IBindableTempla te
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: st*****@online. microsoft.com (Steven Cheng[MSFT])
Organization : Microsoft
Date: Wed, 12 Dec 2007 03:51:40 GMT
Subject: Re: ObjectDataSourc e 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" <j0**@newsgroup s.nospam>
References: <uw************ **@TK2MSFTNGP03 .phx.gbl>
<vj*********** **@TK2MSFTNGHUB 02.phx.gbl>
<Oj*********** ***@TK2MSFTNGP0 2.phx.gbl>
<UO*********** ***@TK2MSFTNGHU B02.phx.gbl>
<ui*********** ***@TK2MSFTNGP0 2.phx.gbl>
>>Subject: Re: ObjectDataSourc e 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

Dec 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5159
by: Dotnet Gruven | last post by:
I've posted this in the adonet group, however it was suggested I might have better luck here.... ============================================================= I'm trying to use a typed dataset and ObjectDataSource binding to a SQLX db using a foreign key to filter the returned result set to display in a GridView. The error message in the subject line is generated when I try to bind the following GridView to the ObjectSource that follows...
12
8708
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
3
1879
by: mthomason | last post by:
I keep getting this error when trying to update records using an ObjectDataSource. I have seen others post similar errors...but I haven't found any solutions. ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateProduct' that has parameters: ProductName, UnitPrice, ProductId. I have been unable to work through this. Any ideas? I’m using code pasted directly from this page:
1
2713
by: Phillip Ian | last post by:
I've got the following: <asp:ObjectDataSource ID="lu" runat="server" TypeName="cFactory" SelectMethod="GetLookup" UpdateMethod="UpdateLookup" DataObjectTypeName="cLookupItem"> <SelectParameters> <asp:QueryStringParameter Name="which" QueryStringField="lookup" /> </SelectParameters> <UpdateParameters>
1
4250
by: tparks69 | last post by:
I get the error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Insert' that has parameters: last_name, first_name, email, role_id, user_id, modified_by, modified_date when my application is trying to insert a record from a formview. It works fine for delete, update, but insert just keeps failing. I have removed the OldValuesParameterFormatString="original_{0}" from the
4
6087
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters are being populated. Integers are being passed as 0 and strings are empty regardless of what I changed them to in Edit mode on the GridView. My object method to perform the update:
9
8854
by: Kernel Bling | last post by:
Hi Everyone, This Saturday the stage was set. The problem simply could not go on existing -- it had to be solved. Many hours, articles, compilations and frustrations later I still did not find an answer. Even pacing around my flat until I nearly went into an altered state of reality proved futile. So here is the problem... When I link up the ObjectDataSource UpdateMethod to a method in the
2
3252
by: rgparkins | last post by:
So, I've bitten the bullet and am converting some of my asp.net 1.1 sites to asp.net 2.0, now after many issues I have come to a stop with the objectdatasource and gridviews and maybe someone can help! I have update, add adapter calls on the objectdatasource working well, however I have an issue with the delete call. In ASP.NET 2.0 I see that invisible columns are now no longer sent across in viewstate (something about security) and...
1
5418
by: Max2006 | last post by:
Hi, I am truing to find a pattern for my Business Logic Layer to be able to work fine win ObjectDataSource's Update method. The challenge is ObjectDataSource is not able to work with an update method that accepts a strongly typed data table as parameters. We have to have an update method with all data table's columns as its parameter. Like what we have here: http://asp.net/learn/data-access/tutorial-16-cs.aspx
3
11196
by: btreddy | last post by:
Hii all, I've a problem regarding passing select parameters to objectdatasource from code behind. i would like to pass the select parameters to a objectdatasource ..not in the selecting or selected event of the objectdatasource but some where in the one of button click event. i tried of adding the parameters but it didn work for me.. <asp:ObjectDataSource ID="ODSEditSchedules" TypeName="Schedules" runat="server"...
0
9599
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10624
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5684
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.