Dec 26, 2012, 6:18 PM
[CLOSED] Submit null as value of a string parameter
When the Submit button is clicked, the Submit DirectMethod is called passing null for the two parameters. The first parameter is a string and the second one is a nullable int.
i would like to know why paramA equals "null" instead of null while paramB equals null, since both parameters are nullable
Thanks in advance
1 - View
i would like to know why paramA equals "null" instead of null while paramB equals null, since both parameters are nullable
Thanks in advance
1 - View
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var submit = function () {
var nullParameter = null;
Ext.net.DirectMethod.request({
url: "/Example/Submit",
cleanRequest: true,
params: {
paramA: nullParameter,
paramB : nullParameter
},
success: function (result) {
alert('Success');
},
failure: function (result) {
alert(result);
}
});
}
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Button Text="Submit" runat="server">
<Listeners>
<Click Handler="submit();" />
</Listeners>
</ext:Button>
</body>
</html>
2 - Controllerpublic class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}
public AjaxResult Submit(string paramA, Nullable<int> paramB)
{
AjaxResult result = new AjaxResult();
if (paramA == "null")
{
result.ErrorMessage = "ParamA parameter is not null on Server";
}
return result;
}
}
Last edited by Daniil; Dec 27, 2012 at 11:02 AM.
Reason: [CLOSED]