carpe2 Posted April 6, 2004 Posted April 6, 2004 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. Quote Adolfo.
georgepatotk Posted April 6, 2004 Posted April 6, 2004 mind to post the portion of the codes here? Quote George C.K. Low
carpe2 Posted April 6, 2004 Author Posted April 6, 2004 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) ................. Quote Adolfo.
MorningZ Posted April 6, 2004 Posted April 6, 2004 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 Quote If you make it idiot proof, they'll build a better idiot :-)
carpe2 Posted April 6, 2004 Author Posted April 6, 2004 I try to put that and it still doesn´t work. I would appreciate any help, please. It´s getting on my nerves. Thanks. Quote Adolfo.
*Gurus* Derek Stone Posted April 6, 2004 *Gurus* Posted April 6, 2004 if (Request.Form("Tipo mensaje") == "Sugerencia") Quote Posting Guidelines
carpe2 Posted April 7, 2004 Author Posted April 7, 2004 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. Quote Adolfo.
wessamzeidan Posted April 10, 2004 Posted April 10, 2004 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 Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.