I have a class at server-side like this:
public class Address
{
public Address(string countryCode)
{
this._CountryCode = countryCode;
}
private string _CountryCode = string.Empty;
public string CountryCode
{
get { return _CountryCode; }
set { _CountryCode = value; }
}
}
and I have a method that called by Ajax methods :
[AjaxMethod]
public static Address ValidateAddress(Address address)
{
// Some logic here...
return address;
}
And I want to call this method in client side, but how can I instantiate the Address class in client side? I do not want to define a class named Address in JavaScript file.
<script>
function valaddress(){
var address = new Address(); // I'm asking here ??
address.CountryCode = 90;
// This part is ok, no problem in here :
var validatedAddress = AddressControlDataHelper.ValidateAddress(address).value;
}
</script>
Is there a way to do this? Or do I need to write my Address class in JavaScript?