Execute (Call) function if value is not empty in ASP.Net MVC

mahesh213
 
on Oct 04, 2021 01:30 AM
470 Views

Hi,

I am trying to implement remote validations

Everything is working fine

But the major issue is that if designation value is empty then IsAlreadySigned method is not calling

As per as my need i need to call that when Designation value is not empty

[Remote("IsAlreadySigned", "Register", HttpMethod = "POST", ErrorMessage = "Already exists.")]
public string Designation { get; set; }

 

[HttpPost]
public JsonResult IsAlreadySigned(string Designation)
{
    return null;
    // return Json(IsUserAvailable(UserEmailId));
}
Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Oct 04, 2021 01:36 AM
on Oct 04, 2021 06:40 AM

Refer below code.

[HttpPost]
public JsonResult IsAlreadySigned(string Designation)
{
    if(!string.IsNullOrEmpty(Designation)
    {
        return Json(IsUserAvailable(Designation));
    }
}