Passing a variable to HTML

  • Thread starter Jim via DotNetMonster.com
  • Start date
J

Jim via DotNetMonster.com

Hi,

I'm creating a control that displays the Previous and Next Pages. I get the
values I want but they don't display in the HTML Href tag. It just displays
blank. I declared the 2 variables PageBack and PageNext outside the sub but
that doesn't seem to work.
I tried using a session variable but I had to reload the page twice to get
the correct number.

<%@ Control Language="VB" %>
<script runat="server">
Dim PageBack as String
Dim PageNext as String

Sub Page_Load(sender As Object, e As EventArgs)
Dim strPageName = System.IO.Path.GetFileName(Request.Path)
Dim PageName as String = strPageName
Dim PageNumber As String = Mid(PageName,5,3)
Dim BackPg as String = PageNumber - 1
Dim NextPg as String = PageNumber + 1
PageBack= Left(PageName,4)&"00"&BackPg &".aspx"
PageNext= Left(PageName,4)&"00"&NextPg &".aspx"
End Sub

</script>
<a href="<%# PageBack %>">Back</a><br>
<a href="<%# PageNext %>">Next</a>


Thanks
 
J

Jim via DotNetMonster.com

Thanks. That still gives me an empty Href. I'm doing a response.write to
make sure there's a value in the variable and there is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top