I'm starting in C # and MVC, I've already done some things in VBA, and I was thinking about translating this into ASP.net MVC5 but I've encountered the problem that before, in the form I had some textbox and to send the focus to one of them when an error occurred, just put textbox.setfocus, but to be another language and have other ways to communicate with the user interface, I do not know how to send the focus to a "textbox" in the view (razor).
I have tried with form["Campo"].algo();
but I have not had any result that is not an error and on the web I only find confusing things and sending focus from the load of the view, but I also get an error when trying one or the other.
Have some idea of how you could send the focus to the field in the view, say:
public actionresult accionDeVista(Formcollection form)
{if(x>0)
{form["campo"].setfocus();
}
else
{
form["campo2"].setfocus();
}
return view();
}
Something like that.