Passing a variable to HTML

Discussion in 'ASP .Net' started by Jim via DotNetMonster.com, Mar 16, 2005.

  1. 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

    --
    Message posted via http://www.dotnetmonster.com
    Jim via DotNetMonster.com, Mar 16, 2005
    #1
    1. Advertising

  2. <a href="'<%# PageBack %>'">Back</a><br>
    Sparky Arbuckle, Mar 16, 2005
    #2
    1. Advertising

  3. 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.

    --
    Message posted via http://www.dotnetmonster.com
    Jim via DotNetMonster.com, Mar 16, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shil
    Replies:
    2
    Views:
    2,024
    Eliyahu Goldin
    Jan 2, 2007
  2. pereges
    Replies:
    7
    Views:
    434
    pereges
    Jun 1, 2008
  3. Jonas Daunoravicius
    Replies:
    5
    Views:
    306
    Peter
    Jul 17, 2003
  4. Steve Cosh
    Replies:
    1
    Views:
    162
    joewiii
    Nov 18, 2005
  5. Jonas Daunoravicius
    Replies:
    5
    Views:
    281
    Peter
    Jul 17, 2003
Loading...

Share This Page