Posting from HTML Form to ASP.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Q29yeSBKLiBMYWlkbGF3LCBCZXlvbmQwMS5jb20=

    Posting from HTML Form to ASP.net

    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="webform 1.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.EventArg s) Handles Me.Load
    Label1.Text = Request("txtDBS earch")
    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.co unt

    it returns 0.

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

    Thanks !!

  • Mark S. Milley

    #2
    Re: Posting from HTML Form to ASP.net


    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="txtDBSear ch" type="text" />
    <input name="Submit1" type="submit" value="submit" /></form>

    Best Regards,

    -Mark


    "Cory J. Laidlaw, Beyond01.com"
    <CoryJLaidlawBe yond01com@discu ssions.microsof t.comwrote in message
    news:A06C826D-5584-4110-850E-C6472908AC65@mi crosoft.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="webform 1.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.EventArg s) Handles Me.Load
    Label1.Text = Request("txtDBS earch")
    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.co unt
    >
    it returns 0.
    >
    Nothing seems to work. If any one can help I would appreciate it.
    >
    Thanks !!
    >

    Comment

    • =?Utf-8?B?Q29yeSBKLiBMYWlkbGF3LCBCZXlvbmQwMS5jb20=

      #3
      Re: Posting from HTML Form to ASP.net

      Mark,

      Well, now I just feel Silly! :)

      Your advice worked great! Thanks a mil!

      Cory

      "Mark S. Milley" wrote:
      >
      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="txtDBSear ch" type="text" />
      <input name="Submit1" type="submit" value="submit" /></form>
      >
      Best Regards,
      >
      -Mark
      >
      >
      "Cory J. Laidlaw, Beyond01.com"
      <CoryJLaidlawBe yond01com@discu ssions.microsof t.comwrote in message
      news:A06C826D-5584-4110-850E-C6472908AC65@mi crosoft.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="webform 1.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.EventArg s) Handles Me.Load
      Label1.Text = Request("txtDBS earch")
      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.co unt

      it returns 0.

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

      Thanks !!
      >

      Comment

      Working...