Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using variable as <ASP:Textbox text

Status
Not open for further replies.

Alpha7

Programmer
Nov 4, 2002
6
US
Hello,
I'm trying to add a date I've called from a database that I've passed to a session variable to the default value in a textbox.

<ASP:Textbox Enabled=&quot;true&quot; id=&quot;text100&quot; maxlength=&quot;25&quot; backcolor=&quot;#8080b0&quot; Text=<%=Session[&quot;sent_date&quot;]%> Forecolor=&quot;#FFFFFF&quot; class=&quot;navSmall&quot; runat=&quot;server&quot; />

The error I get is:
Parser Error Message: Server tags cannot contain <% ... %> constructs.

Does anyone know how I can place a variable into this value?

Thanks,
A7
 
you could do with the below code
<script language=&quot;VB&quot; runat=&quot;server&quot;>
Sub Page_Load(sender As Object, e As EventArgs)
text100.text = Session(&quot;sent_date&quot;)
End Sub
</script>


 
Just a note
In order to make full use of .Net enhancements try at all costs to aviod spagetti code (vb code intermingled in html) such as cbokowski suggested. Instead use the code behind model that all .net languages utilize. The new code will be very similiar to cbo's code, but in a different file. If you need more help understanding the code behind model feel free to post. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Thanx Guys,
That's what that's what I had to do :)
A7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top