Jump to content

add value to textbox


joecool2005

Recommended Posts

Hi,On the code below how can I add the lname value to my textbox?Thx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="dataListVB.aspx.vb" Inherits="dataListVB" %><%Dim lname As String = "Smith"%><FORM NAME="Form" METHOD="POST" runat=server><asp:TextBox id="LastName" runat="server" /></FORM>

Link to comment
Share on other sites

By doing this it changes the value of the textbox but it will not display on the textbox. Is it possible to display it inside the textbox?

<asp:TextBox id="LastName" runat="server" /> <% Dim lname As String = "Smith" LastName.Text = lname%>

Link to comment
Share on other sites

using ASP style tags is not a good practiceeither use codebehind or at the very least do this

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="dataListVB.aspx.vb" Inherits="dataListVB" %><script runat="server">void Page_Load(){  Dim lname As String = "Smith"  LastName.Text = lname}</script><FORM NAME="Form" METHOD="POST" runat=server><asp:TextBox id="LastName" runat="server" /></FORM>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...