Use of Request.Form

carpe2

Freshman
Joined
Jan 16, 2004
Messages
42
Location
Spain
Hi, i´m trying to do a form as i did in html, and address the method post to an ASP.NET page, to work with the data got in the form. If i try to do Request.Form(variable) as i did in ASP 3 i´ve got an error. Could anybody tell me how can i do it??
Thanks.
 
Here it is the .aspx code of the form(for example)
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Laboratorios.WebForm1" enableViewState="True" enableViewStateMac="False"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
................................
<form method="POST" action="Laboratorios.aspx">
<dd>
<input type="radio" name="Tipo mensaje" value="Queja">Queja <input type="radio" name="Tipo mensaje" value="Problema">Problema
<input type="radio" checked name="Tipo mensaje" value="Sugerencia">Sugerencia <input type="radio" name="Tipo mensaje" value="Elogio">Elogio
..............
<input type="submit" value="Enviar comentarios" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 128px"> 
<td></td>
<input type="reset" value="Borrar formulario" style="Z-INDEX: 103; LEFT: 240px; POSITION: absolute; TOP: 128px">
</form>
</form>
</DD>
</body>
</HTML>

and in the .aspx.cs code of an asp.net page i want to do something like that
if(Request.Form(Tipo mensaje)==Sugerencia)
.................
 
Forgot to quote the item name and what you are comparing against.... all "Request.Form" items are strings, so:

if(Request.Form('Tipo mensaje')=='Sugerencia')

should work
 
I try to put that and it still doesn´t work.
I would appreciate any help, please. It´s getting on my nerves.
Thanks.
 
I don´t know if i´m doing something wrong, but it still doesn´t work. When i write that code there´s an error in that line, translating from spanish to english it would say something like that:
System.Web.HttpRequest.Form show property, when a method was expected
Thanks in advance for any help.
 
I can suggest two reasons:
1. The name of the html has a space.
2. The html control is a radio button, so may be Request.Form("Tipo mensaje") returns some sort of a boolean
 
Back
Top