Posting from HTML Form to ASP.net

  • Thread starter Thread starter Cory J. Laidlaw, Beyond01.com
  • Start date Start date
C

Cory J. Laidlaw, Beyond01.com

Hello!

I need to retrieve POST information from an HTML form into my VB ASP.net
2008 web form.

My simple html form is:
<form action="webform1.aspx" method="post" name="Form1">
<input id="txtDBSearch" type="text" />
<input id="Submit1" type="submit" value="submit" /></form>


My simple asp.net web form code is

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Label1.Text = Request("txtDBSearch")
End Sub

However, this code does not work. If I enter something in the field in the
HTML page and submit it, then breakpoint the label1.text line, and in the
immediate window I type:

? request.form.count

it returns 0.

Nothing seems to work. If any one can help I would appreciate it.

Thanks !!
 
Hi Cory -

You've simply got your domains confused. :-)

You must include the name attribute in your input tags. HTML forms don't
submit data using the id attribute.

Try--

<input name="txtDBSearch" type="text" />
<input name="Submit1" type="submit" value="submit" /></form>

Best Regards,

-Mark


"Cory J. Laidlaw, Beyond01.com"
 
Mark,

Well, now I just feel Silly! :)

Your advice worked great! Thanks a mil!

Cory
 
Back
Top