3
The program has in the session some customer data, as CPF and Full address (including state where you live). If the customer is from São Paulo, enable a specific combo, if it is from another state, not enable. In this case, then, I have to check the session if the state is São Paulo. The question is: The only way to do this is, check by code and return an ajax pro javascript to disable there or have I do everything in C#?
In webforms I had the controls that allowed me to do this in C#, but I don’t know how I do it in MVC since the only one that has access to HTML elements is javascript.
Way I’m doing now:
public JsonResult HabilitaCombo()
{
if (Session["_CliEstado"].ToString() == "São Paulo") {
return Json(new {habilita = true });
}
else
{
return Json(new { habilita = false});
}
}
Aaah now it’s clear! Thank you!
– Junior Dias