0
What is Request.Form? How do I interpret these lines?
if (Request.Form["chkTornarObrigatorio"] != null)
ventRegPendencia.IcDocObrigatorio = int.Parse(Request.Form["chkTornarObrigatorio"]);
0
What is Request.Form? How do I interpret these lines?
if (Request.Form["chkTornarObrigatorio"] != null)
ventRegPendencia.IcDocObrigatorio = int.Parse(Request.Form["chkTornarObrigatorio"]);
2
Request is an ASP.NET class that allows reading values sent during a Web request.
What is Request.Form?
It’s a property (Request Form.) of the Request class you can use to retrieve the values of the form elements posted in the HTTP request body.
How I interpret these lines?
//Com base no nome do elemento do seu formulário,
//verifica se o campo chkTornarObrigatorio não está nulo
if (Request.Form["chkTornarObrigatorio"] != null)
{
//Caso não esteja nulo, converte o valor do campo chkTornarObrigatorio
//para o tipo inteiro e associa a ventRegPendencia.IcDocObrigatorio
ventRegPendencia.IcDocObrigatorio = int.Parse(Request.Form["chkTornarObrigatorio"]);
}
Take a look at the links I added for more details.
2
The Request.Form
is used to obtain information from a Ubmit of an HTML form that was sent via POST. As the POST information is invisible to the user, you must recover through the Request method.
The line in question is interpreted as follows::
//O campo chkTornarObrigatorio foi enviado pelo formulário de uma outra página via post, nesta linha verificamos se ele está preenchido
if (Request.Form["chkTornarObrigatorio"] != null)
{
//Se o campo existir, nós pegamos o valor do campo e convertemos para inteiro a
ventRegPendencia.IcDocObrigatorio = int.Parse(Request.Form["chkTornarObrigatorio"]);
}
Basically, you are searching for the value that was sent from another page, see this link as a reference.
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.