Problem with updating record with objectdatasource




Hi,

I'm new to the new asp.net :-). I've set up a web form with a grid
and an objectdatasource (in my presentation layer). I have a seperate
datalayer project which has webservices in it. I tell the
objectdatasource what my update method is by refering to a web service
method through a web reference in the presentation layer (The webmethod

IS my update method).


This almost works. What I've found is that the web service parameters

are all of the fields in the grid (including the pk) and an original
version of the pk is tacked on to the end of the paramaters. Before I
did this I was getting errors telling me that it couldn't find a
non-generic ..I'm sure you've all seen the error.


Once I got rid of that error by giving the web method the signature
the objectdatasource wanted, I still couldn't update data. I tried just

running the web service by itself which worked. However when I ran the
code (gridview and all) and checked the parameters coming into the
webservice, I found that the original version of the pk was zero. I
changed it in the debugger to the be same value of the pk parameter
being passed and I was able to save my changes.


I'm not sure what is wrong here. Is there a setting somewhere that
will pass the correct value of the original pk from the
objectdatasource to my web method?


Thanks,
Fig


Reply »

.



Relevant Pages

  • Re: Problem with updating record with objectdatasource
    ... One thing I have found out is that the name of the parameter variables that your web service method accepts should be identical to the names of the bound column names. ... If you have a colum data field called ID and firstName (these are listed in the objectDataSource parameters) then your webservice method should have these exact parameter names void update, etc. ... and an objectdatasource (in my presentation layer). ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Next problem :) GridView - formatting text
    ... Editor and add the fields into there manually. ... This pre-builds the grid ... You can even convert these fields into template fields. ... ObjectDataSource linked to a class file (placed in the App_Code ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Problem updating with object datasource
    ... I've set up a web form with a grid ... and an objectdatasource (in my presentation layer). ... What I've found is that the web service parameters ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • objectdatasource fires automatically...
    ... the page the grid is filled immediatly after page loads. ... firing the object datasource? ... should fire the objectdatasource and fill the grid iso automatically ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: GridView with FormView question
    ... How do I get the grid to refresh itself? ... I guess its also important to note that I am use datacontrollers for ... Are you using objectdatasource? ...
    (microsoft.public.dotnet.framework.aspnet)