asp.net - ObjectDataSource not calling Insert method when it has extra parameters -


I'm new to ASP.net, and I'm trying to implement a custom objectadressor insert method. The default business method works fine (with an object parameter) However, when I add an additional parameter, the business method is not called.

Here is my code - Insert () is always called, but never included () is never included.

  // Business Layer Public Class MyObject {Public MyObject () {} Public String Foo {get; Set;}} Nameshot Mylogic {Public Static Insert (MyObase M) {// ... Insert DB} Public Static InsertWithParams (MyObject M, String P) {// ... more fancy DB insert}} // MyLogic < / Code> 

Looking at the following ObjectDataSource declaration, "InsertWithParams" and "MyObjectDS_Inserting" are never asked.

However if "MyLogic.Instert" is specified instead, then it comes along with the incident. Apart from this, if I remove the p parameter from InsertWithParams, then it is called.

  and asp: ObjectDataSource runat = "server" id = "myobject" type name = "business.mayologic" DataObjectTypeName = "Business.MyObject" InsertMethod = "InsertWithParams" OnInserting = "MyObjectDS_Inserting" & gt; ; & Lt; InsertParameters & gt; & Lt; Asp: parameter name = "m" type = "object" /> & Lt; Asp: parameter name = "p" type = "string" / & gt; & Lt; / InsertParameters & gt; & Lt; / ASP: ObjectDataSource & gt;  

So it seems that I can not add parameters to an insert method in an ObjectDataSource. It does not make any difference in the addition or removal of announced instatamatrates.

I also had trouble putting the record, however, after testing for a while And after a while Google came to know that if you specify the 'DataObjectTypeName' parameter in ObjectDataSource, InsertParameters are ignored. So I do not specify this, and it works for me.

From here:


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -