[Remote("DropDownSelected", "Patient")]
public Guid SexIdentifier { get; set; }
public ActionResult DropDownSelected(object value)
{
var x = ((Guid)value).ToString();
string xsd = value.ToString();
var abc = ControllerContext.Controller;
if (value == null)
{
//value = string.Empty;
}
if (value.ToString() == Convert.ToString(Guid.Empty) || value.ToString() == string.Empty)
{
return Json(String.Format("0 does not exist."), JsonRequestBehavior.AllowGet);
}
return Json(true, JsonRequestBehavior.AllowGet);
}
Asked
Active
Viewed 267 times
0

Ihor Kaharlichenko
- 5,944
- 1
- 26
- 32

Balpreet_1988
- 29
- 5
1 Answers
0
If your property is called SexIdentifier
then your action must use the same name for its argument:
public ActionResult DropDownSelected(Guid sexIdentifier)
{
...
}
Also if you have a default value of the dropdown you could use a nullable Guid
:
public ActionResult DropDownSelected(Guid? sexIdentifier)
{
...
}

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928
-
But i need to use this validation for multiple properties is there any way i can give a common alias name – Balpreet_1988 Aug 15 '12 at 10:02
-
You could try reading it from the POST body: `Request.Form[0]`. – Darin Dimitrov Aug 15 '12 at 10:05