How to display script variables in asp.net2?

Discussion in 'C#' started by dolin88, Jul 26, 2008.

  1. #1
    Hi I am using c# as my scripting in asp.net2? How do i display script variables?

    <%
    string x="";
    %>
    <%= x%>

    This gets and error message where x is not defined.
     
    dolin88, Jul 26, 2008 IP
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    dim x as string

    x = ""
     
    ludwig, Jul 27, 2008 IP
  3. vihutuo

    vihutuo Well-Known Member

    Messages:
    1,511
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #3
    It works perfectly well

    <% string x = "";%>
    <%= x %>
     
    vihutuo, Aug 4, 2008 IP
  4. engager

    engager Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    by the way, one can output concatated strings with the same way just concluding these stingrs to ()

    <% string x1 = "1"; string x2 = "2";%>
    <%= (string1 & string2) %>

    ))
     
    engager, Aug 14, 2008 IP