Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an HTML Textbox in place of an ASP.NET TextBox

If I add this to the ASPX page:

<input id="Text1" type="text" value="Text1Value" />

I would expect to see "Text1" in the list of Request Form keys even WITHOUT setting the runat=Server property.

? request.Form.AllKeys

I realize that if I do set that propery, then I will have a server-sided HTML control that I can reference using the name "Text1", but shouldn't I be able to access the text in the text box using the following VB.NET syntax?

request.Form("Text1")
like image 300
Chad Avatar asked Mar 31 '10 23:03

Chad


People also ask

What is the difference between HTML TextBox and HTML TextBox for using ASP NET MVC Razor engine?

IMO the main difference is that Textbox is not strongly typed. TextboxFor take a lambda as a parameter that tell the helper the with element of the model to use in a typed view. You can do the same things with both, but you should use typed views and TextboxFor when possible. Save this answer.

How do you code a TextBox in HTML?

The HTML textbox is an input control that allows the user to enter the text input on the web page. The <input type = “text”> is used to create a textbox.

What is HTML TextBoxFor?

TextBoxFor() The TextBoxFor<TModel, TProperty>() is the generic extension method that creates <input type="text"> control. The first type parameter is for the model class, and second type parameter is for the property.


1 Answers

Because you need to add the name attribute. Try this

<input id="Text1" name="Text1" type="text" value="Text1Value" />

like image 82
Claudio Redi Avatar answered Nov 15 '22 04:11

Claudio Redi