Beginner
Beginner

Reputation: 29543

how to pass a value to the code behind asp?

Erm i am new to this. How do i pass the value the user enters into a text box to the vb code behind?

<input type="text" runat="server" id="amount" name="amount" size="15" />

Upvotes: 1

Views: 1108

Answers (2)

Pranay Rana
Pranay Rana

Reputation: 176906

No need to pass the value As its RunAt = server you can directly access value of the text box using its Text property

Example

amount.Value 

or you can make use of Request collection to get the value of the textbox Request.Form["amount"]

Upvotes: 4

Tim Schmelter
Tim Schmelter

Reputation: 460138

Use the ASP.NET-TextBox Control.

<asp:TextBox ID="TextBox1" runat="server"/>

Then you can access it from codebehind via it's ID

Dim Textbox1Text As String = Me.TextBox1.Text

The Text will automatically persisted in ViewState across postbacks by default.

Upvotes: 3

Related Questions