Writing Html Coding By asp

Discussion in 'C#' started by qq2, Dec 30, 2008.

  1. #1
    i need to write html code using asp . it's works fine . but how can i reading variable in the coding???following is my coding
    <%

    Dim HTML
    dim x
    x = "abcdefg"
    HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
    HTML = HTML & "<html>"
    HTML = HTML & "<head>"
    HTML = HTML & "<meta http-equiv=""Content-Type"""
    HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
    HTML = HTML & "<meta name=""GENERATOR"""
    HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"
    HTML = HTML & "<title>HTML</title>"
    HTML = HTML & "</head>"
    HTML = HTML & "<body bgcolor=""FFFFFF"">"
    HTML = HTML & "<table width=""699"" border=""2"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
    HTML = HTML & " <tr align=""center"" valign=""top"">"
    HTML = HTML & " <td width=""29%"" rowspan=""8""><div align=""right""><img src=""ace.jpg"" alt=""ace"" width=""159"" height=""158""></div></td>"
    HTML = HTML & " <td height=""22""> "
    HTML = HTML & " </td>"
    HTML = HTML & " </TABLE>"
    HTML = HTML & "Testing data Header</strong></p>"
    HTML = HTML & "<p><font size =""2"" face=""Tahoma"">"
    HTML = HTML & "Testing Address<br>"

    HTML = HTML & "Testing Address2.</p>"
    HTML = HTML & "</body>"
    HTML = HTML & "</html>"
    %>

    how can i insert my variable to it. or session ..

    Please help . thanks
     
    qq2, Dec 30, 2008 IP
  2. davejames10

    davejames10 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To put the variable into session do the following :

    Session("whatever") = HTML

    replacing "whatever" with your desired session variable name

    to output the contents on the variable do the following :

    Response.Write(HTML)

    cheers,
    dave.
     
    davejames10, Jan 3, 2009 IP
  3. jgarrison

    jgarrison Peon

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Is this what you're looking for?

    HTML = HTML & "Variable: " & x & "<br>"

    -Jim
     
    jgarrison, Jan 5, 2009 IP
  4. deltron

    deltron Active Member

    Messages:
    397
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    73
    #4
    I think jgarrison gave you what your looking for. I would also say replace

    HTML = HTML & "example"

    with

    HTML += "example"

    It is a lot cleaner and does the same thing.
     
    deltron, Jan 5, 2009 IP
  5. qq2

    qq2 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks you guys help. that's the one i'm looking for. thanks. :p
     
    qq2, Jan 7, 2009 IP
  6. tantora

    tantora Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Dim strMyVariable
    strMyVariable = "Testing"

    HTML = HTML & "<p>" & strMyVariable & "</p>"
     
    tantora, Jan 10, 2009 IP
  7. Link.ezer.com

    Link.ezer.com Peon

    Messages:
    647
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #7
    you may use function() instead of using lots of [ HTML = HTML & ]
    then you do not worry how to put Variable any more
     
    Link.ezer.com, Jan 11, 2009 IP
  8. 00teen

    00teen Guest

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Session is not good idea for this reason. HTML = HTML & "Variable: " & x & "<br>" is right.
     
    00teen, Jan 21, 2009 IP