0
[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);
}
4

1 回答 1

0

如果您的属性被调用SexIdentifier,那么您的操作必须为其参数使用相同的名称:

public ActionResult DropDownSelected(Guid sexIdentifier) 
{
    ...
}

此外,如果您有下拉列表的默认值,则可以使用 nullable Guid

public ActionResult DropDownSelected(Guid? sexIdentifier) 
{
    ...
}
于 2012-08-15T09:30:15.890 回答