hello people.. here is what i've done...<BR>below is a text box with id as firstname.. <BR>what i want to do is to get the value of firstname.. how can i get this done?<BR>with asp3.0 its request.form("firstname") how is this done with asp.net? i'm using vb.net thanks for taking the the time and trouble to reply.<BR><asp:textbox id="firstname" value=http://aspmessageboard.com/archive/index.php/<%#DataBinder.Eval(container.dataitem,"firstname")%> runat="server" /><BR><BR>In your server-side code you could do:<BR><BR>sub Page_Load(sender as Object, e as EventArgs)<BR> Dim tbValue as String = firstname.Text<BR>End Sub<BR><BR>It's that easy!
You may want to put that line in a button event handler, if you only care about the value when the form is submitted... hthAfter submitting the form here is what i did<BR><BR>Protected Sub SaveAll_OnClick(ByVal sender As Object, ByVal e As EventArgs)<BR> Dim tbValue As String = firstname.Text<BR>End Sub<BR><BR>and i still get the same error as below<BR><BR>Object reference not set to an instance of an object. <BR><BR><BR><BR>Line 118:<BR>Line 119: Protected Sub SaveAll_OnClick(ByVal sender As Object, ByVal e As EventArgs)<BR>Line 120: Dim tbValue As String = firstname.Text<BR>Line 121: End Sub<BR>Line 122:<BR> <BR>Try this:<BR>Protected Sub SaveAll_OnClick(ByVal sender As Object, ByVal e As EventArgs)<BR>Dim tbValue As String<BR>tbValue = firstname.Text<BR>End SubMake sure that you have declared an instance of the TextBox control in your server-side code... i.e.:<BR><BR>' #### Declare the instance member<BR>Protected WithEvents firstname As System.Web.UI.WebControls.TextBox<BR><BR>Protected Sub SaveAll_OnClick( ByVal sender As Object, ByVal e As EventArgs )<BR> Dim tbValue As String = firstname.Text<BR>End Sub
