Re: Problem with updating record with objectdatasource




"fig000" <neilnewton001@xxxxxxxxx> wrote in message news:1154019379.708440.97940@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Common issue with using ObjectDataSource control with custom objects. 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 (int ID, string firstName ), etc.

Also, the objectDataSource sends both the old values and the new values to each method it calles. To remove that you must set the OldValuesParameterFormatString of the ObjectDataSource to {0} instead of original_{0}

Hopefully, this may provide you with some assistance.


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: VS2005 DataList with Nested GridView using ObjectDataSource
    ... | Subject: Re: VS2005 DataList with Nested GridView using ObjectDataSource ... | 1) I bound the DataList control to the web service method that returns ... | display the Items for each customer. ... | inside the DataList ItemTemplate so that my GridView can see it when I ...
    (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)
  • Problem with updating record with objectdatasource
    ... 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.adonet)
  • Securing TableAdapters/xds files
    ... was using webservices which used dataadapters to retrieve and update ... the web services were called from the presentation layer and were ... on a seperate server from the presentation layer. ... I've been interested in using the objectdatasource since there's so ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • problems with ObjectDataSource and filtering
    ... I am trying the new ObjectDataSource from ASP.NET 2.0. ... The method of the webservice looks like this: ... public int GetNumberOfRows() ... Paging and sorting works but now I want to be able to get filtering ...
    (microsoft.public.dotnet.framework.aspnet)