I can see a number of ppl had trouble with the error "Specified method
is not supported". I am also having the same trouble.. I have checked
my code and I can't find anything unusual about it. I just want to
pass an object back to the server and I am stuck with that error.
My .net class looks like this. It is a plain class with all variables
public and a public no-argument constructor. (note: ApasRegularView is
another class with similar structure).
public class ClassFeeView
{
public long Id;
public long IdPaymentAdvice;
public ApasRegularView RegularClass;
public int Absence;
public int Prorate;
public int Makeup;
public int Forfeit;
public int Credit;
public int NextMonthCredit;
public int CreditAdjustment;
public int PayableCredit;
public decimal PerLessonFee;
public decimal PayableFee;
public string PrivateRemark;
public string PublicRemark;
public string PaymentAdviceText;
public int IsExcluded;
public string ColorCode;
public string Status;
public ArrayList FeeDeviations;
public string TransientStatus;
public ClassFeeView()
{
FeeDeviations = new ArrayList();
TransientStatus = "";
}
one of my .net method returns an array of those ClassFeeView objects
and they are displayed at client browser. When the user click submit,
browser javascript will fill the object with user inputs and submit it
to my .net method below
[AjaxPro.AjaxMethod()]
public ClassFeeView UpdateClassFee(ClassFeeView obj)
{
... code to update and return updated ClassFeeView object
}
There, i am getting "Specified method is not supported" error.
Ok. there was one hiccup. The object I am trying to submit back to the
server is not the instance that I received from the server (unlike
Michael Schwarz's class example where the object submitted back to the
server is the same instance received from the server but I really dun
think this matters anyway, am I right? example url:
http://www.ajaxpro.info/Examples/Classes/default.aspx ) . Because the
object undergoes some changes during its stay in client browser (added
some additional properties) and I need to keep the instance unchanged,
I "clone" the object using Prototype library's Object.clone method,
strip cloned object off additional properties I added in my code (so
that the object I submit back to the server have the same properties
as it had originally), and I even set the two "dangerous" properties
null. (the ApasRegularView, and FeeDeviation ArrayList). But, the
error persists.. I have no idea what is wrong. Can anyone help me?
thanks a lot.
There must be non null variable. So in constructor you have to assign
temprorary values. Int double float etc. does not matter but string variable
can be null so you should assign string.Empty in constructor. If you get an
instance and take to javascript side this null variable cause errors. So
assign string.Empty to string variables.
On Fri, Jul 18, 2008 at 6:36 PM, kyithaa...@gmail.com <kyithaa...@gmail.com>
wrote:
> I can see a number of ppl had trouble with the error "Specified method
> is not supported". I am also having the same trouble.. I have checked
> my code and I can't find anything unusual about it. I just want to
> pass an object back to the server and I am stuck with that error.
> My .net class looks like this. It is a plain class with all variables
> public and a public no-argument constructor. (note: ApasRegularView is
> another class with similar structure).
> public class ClassFeeView
> {
> public long Id;
> public long IdPaymentAdvice;
> public ApasRegularView RegularClass;
> public int Absence;
> public int Prorate;
> public int Makeup;
> public int Forfeit;
> public int Credit;
> public int NextMonthCredit;
> public int CreditAdjustment;
> public int PayableCredit;
> public decimal PerLessonFee;
> public decimal PayableFee;
> public string PrivateRemark;
> public string PublicRemark;
> public string PaymentAdviceText;
> public int IsExcluded;
> public string ColorCode;
> public string Status;
> public ArrayList FeeDeviations;
> public string TransientStatus;
> public ClassFeeView()
> {
> FeeDeviations = new ArrayList();
> TransientStatus = "";
> }
> one of my .net method returns an array of those ClassFeeView objects
> and they are displayed at client browser. When the user click submit,
> browser javascript will fill the object with user inputs and submit it
> to my .net method below
> [AjaxPro.AjaxMethod()]
> public ClassFeeView UpdateClassFee(ClassFeeView obj)
> {
> ... code to update and return updated ClassFeeView object
> }
> There, i am getting "Specified method is not supported" error.
> Ok. there was one hiccup. The object I am trying to submit back to the
> server is not the instance that I received from the server (unlike
> Michael Schwarz's class example where the object submitted back to the
> server is the same instance received from the server but I really dun
> think this matters anyway, am I right? example url:
> http://www.ajaxpro.info/Examples/Classes/default.aspx ) . Because the
> object undergoes some changes during its stay in client browser (added
> some additional properties) and I need to keep the instance unchanged,
> I "clone" the object using Prototype library's Object.clone method,
> strip cloned object off additional properties I added in my code (so
> that the object I submit back to the server have the same properties
> as it had originally), and I even set the two "dangerous" properties
> null. (the ApasRegularView, and FeeDeviation ArrayList). But, the
> error persists.. I have no idea what is wrong. Can anyone help me?
> thanks a lot.
-- Murat Tüfekçi
MDM IT - Dim-ension Software Group
Main Developer
www.dim-ension.com
The error I am talking about is not from server to client but from
client to server. Server to client has no problem. The problem is when
the client browser submit the object back to server, the server asp
code hit the error "Specified method
is not supported".
But, anyway, I think I've found the problem (if i am not wrong). The
problem is with Decimal and I think Michael's code (ajaxpro code) has
a slight problem with Decimal datatype. I eliminated suspicious
properties one by one and the error is no longer thrown when I removed
Decimal. When i change Decimal to Double, it works fine. So, I checked
Michael's source code. And, I found this problem.
When decimal numbers are submitted back to server, in the submitted
json string, the decimal values are quoted. When attempting to
deserialize the value, the method to deserialize it (in
DecimalConverter.cs) expects a number and it gets a string, so the
error is thrown. So, I think we need to change the client code to
submit the decimal values without quotes. I sent a message to Michael
but he has not replied yet. Anw, since I don't know how to remove
quotes, I just modified the DecimalConverter.cs to not throw the error
and it is working fine for me now.
On Jul 22, 2:52 pm, "Murat Tufekci" <tufe...@gmail.com> wrote:
> There must be non null variable. So in constructor you have to assign
> temprorary values. Int double float etc. does not matter but string variable
> can be null so you should assign string.Empty in constructor. If you get an
> instance and take to javascript side this null variable cause errors. So
> assign string.Empty to string variables.
> On Fri, Jul 18, 2008 at 6:36 PM, kyithaa...@gmail.com <kyithaa...@gmail.com>
> wrote:
> > I can see a number of ppl had trouble with the error "Specified method
> > is not supported". I am also having the same trouble.. I have checked
> > my code and I can't find anything unusual about it. I just want to
> > pass an object back to the server and I am stuck with that error.
> > My .net class looks like this. It is a plain class with all variables
> > public and a public no-argument constructor. (note: ApasRegularView is
> > another class with similar structure).
> > public class ClassFeeView
> > {
> > public long Id;
> > public long IdPaymentAdvice;
> > public ApasRegularView RegularClass;
> > public int Absence;
> > public int Prorate;
> > public int Makeup;
> > public int Forfeit;
> > public int Credit;
> > public int NextMonthCredit;
> > public int CreditAdjustment;
> > public int PayableCredit;
> > public decimal PerLessonFee;
> > public decimal PayableFee;
> > public string PrivateRemark;
> > public string PublicRemark;
> > public string PaymentAdviceText;
> > public int IsExcluded;
> > public string ColorCode;
> > public string Status;
> > public ArrayList FeeDeviations;
> > public string TransientStatus;
> > one of my .net method returns an array of those ClassFeeView objects
> > and they are displayed at client browser. When the user click submit,
> > browser javascript will fill the object with user inputs and submit it
> > to my .net method below
> > [AjaxPro.AjaxMethod()]
> > public ClassFeeView UpdateClassFee(ClassFeeView obj)
> > {
> > ... code to update and return updated ClassFeeView object
> > }
> > There, i am getting "Specified method is not supported" error.
> > Ok. there was one hiccup. The object I am trying to submit back to the
> > server is not the instance that I received from the server (unlike
> > Michael Schwarz's class example where the object submitted back to the
> > server is the same instance received from the server but I really dun
> > think this matters anyway, am I right? example url:
> >http://www.ajaxpro.info/Examples/Classes/default.aspx) . Because the
> > object undergoes some changes during its stay in client browser (added
> > some additional properties) and I need to keep the instance unchanged,
> > I "clone" the object using Prototype library's Object.clone method,
> > strip cloned object off additional properties I added in my code (so
> > that the object I submit back to the server have the same properties
> > as it had originally), and I even set the two "dangerous" properties
> > null. (the ApasRegularView, and FeeDeviation ArrayList). But, the
> > error persists.. I have no idea what is wrong. Can anyone help me?
> > thanks a lot.
> --
> Murat Tüfekçi
> MDM IT - Dim-ension Software Group
> Main Developerwww.dim-ension.com
>The error I am talking about is not from server to client but from >client to server. Server to client has no problem. The problem is when >the client browser submit the object back to server, the server asp >code hit the error "Specified method >is not supported".
>But, anyway, I think I've found the problem (if i am not wrong). The >problem is with Decimal and I think Michael's code (ajaxpro code) has >a slight problem with Decimal datatype. I eliminated suspicious >properties one by one and the error is no longer thrown when I removed >Decimal. When i change Decimal to Double, it works fine. So, I checked >Michael's source code. And, I found this problem.
>When decimal numbers are submitted back to server, in the submitted >json string, the decimal values are quoted. When attempting to >deserialize the value, the method to deserialize it (in >DecimalConverter.cs) expects a number and it gets a string, so the >error is thrown. So, I think we need to change the client code to >submit the decimal values without quotes. I sent a message to Michael >but he has not replied yet. Anw, since I don't know how to remove >quotes, I just modified the DecimalConverter.cs to not throw the error >and it is working fine for me now.