Author: Brett Nieland | Posted on: 11/27/2008 5:16:04 PM | Views : 944

Folks,



How can I add functions to a JavaScript type generated by using the GenerateScriptType in a web service.



Basicly, the C# class has data members that are serialized and passed to the client to be deserialized javascript objects whoose type bears the same name as the c# type.



Of course, methods can not be shared.



So let's say I have a c# type

/////////////////////////
// BEGIN FILE: CDog.cs //
/////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AddJavascriptMethodTest
{
[Serializable]
public class CDog
{
public CDog()
{
this._sColor = "Brown";
}
public CDog(string sColor)
{
this._sColor = sColor;
}

private string _sColor = null;

public string Color { get { return _sColor; } }
}
}
///////////////////// ...

Go to the complete details ...