how to use old INPUT tags

  • Thread starter Thread starter Brad Williams
  • Start date Start date
B

Brad Williams

I want to see posted values from old-school INPUT tags, but when I do this:

<form id="Form1" method="post" runat="server">
<input type=text id="test1" value="hello" >
<asp:Button ID="btnSubmit" Text="Submit" Runat="server"></asp:Button>
</form>

in the btnSubmit_Clicked callback I do not see a key for "test1" in the
Request.Forms collection as I would expect. How/where can I see such
submitted values? I do not want to use runat=server.

Brad Williams
 
I figured it out. If you don't use runat="server", then you gotta specify a
name attribute in the INPUT tag. Duh.
 
Have you tried looking in Request.Form("test1"), rather than
Request.Forms("test1")?

There is no reason why this wouldn't work as usual.
 
Hey Brad,

Try giving the control the Name attribute rather than just the ID:

<form id="Form1" method="post" runat="server">
<input type=text id="test1" name="test1" value="hello" >
<asp:Button ID="btnSubmit" Text="Submit" Runat="server"></asp:Button>
</form>

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If IsPostBack Then
Response.Write _
(Request.Form.Item("test1").ToString)
End If
End Sub

Ken
Microsoft MVP [ASP.NET]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top