how to pass a variable from test.aspx.vb to test.aspx

Discussion in 'ASP .Net Datagrid Control' started by Chris, May 11, 2006.

  1. Chris

    Chris Guest

    Hi,

    I use code-behind, but how can i pass a variable from test.aspx.vb to
    test.aspx?

    Test.aspx.vb contains this:
    Partial Class test
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Load

    dim lol as string
    lol="Carl"
    .....


    In test.aspx, i want to have: hello Carl
    So i did:
    <form id="form1" runat="server">
    <asp:Label Runat="server">Hello <%=lol%></asp:Label>


    But i get the error: "Name 'lol' is not declared"

    Thanks
     
    Chris, May 11, 2006
    #1
    1. Advertising

  2. Chris

    Chris Guest

    Sorry, wrong group ...
    I put it in the right one ...

    "Chris" <> wrote in message
    news:...
    > Hi,
    >
    > I use code-behind, but how can i pass a variable from test.aspx.vb to
    > test.aspx?
    >
    > Test.aspx.vb contains this:
    > Partial Class test
    > Inherits System.Web.UI.Page
    > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Me.Load
    >
    > dim lol as string
    > lol="Carl"
    > ....
    >
    >
    > In test.aspx, i want to have: hello Carl
    > So i did:
    > <form id="form1" runat="server">
    > <asp:Label Runat="server">Hello <%=lol%></asp:Label>
    >
    >
    > But i get the error: "Name 'lol' is not declared"
    >
    > Thanks
    >
    >
     
    Chris, May 11, 2006
    #2
    1. Advertising

  3. Chris

    Manikandan Guest

    Declare the variable as protected or public and access it in the test.aspx
    page
    using the <% %> Tag

    "Chris" <> wrote in message
    news:...
    > Sorry, wrong group ...
    > I put it in the right one ...
    >
    > "Chris" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I use code-behind, but how can i pass a variable from test.aspx.vb to
    >> test.aspx?
    >>
    >> Test.aspx.vb contains this:
    >> Partial Class test
    >> Inherits System.Web.UI.Page
    >> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Me.Load
    >>
    >> dim lol as string
    >> lol="Carl"
    >> ....
    >>
    >>
    >> In test.aspx, i want to have: hello Carl
    >> So i did:
    >> <form id="form1" runat="server">
    >> <asp:Label Runat="server">Hello <%=lol%></asp:Label>
    >>
    >>
    >> But i get the error: "Name 'lol' is not declared"
    >>
    >> Thanks
    >>
    >>

    >
    >
     
    Manikandan, May 12, 2006
    #3
  4. Chris

    Manikandan Guest

    Declare the variable with public or protected access modifier


    "Chris" <> wrote in message
    news:...
    > Sorry, wrong group ...
    > I put it in the right one ...
    >
    > "Chris" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I use code-behind, but how can i pass a variable from test.aspx.vb to
    >> test.aspx?
    >>
    >> Test.aspx.vb contains this:
    >> Partial Class test
    >> Inherits System.Web.UI.Page
    >> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    >> System.EventArgs) Handles Me.Load
    >>
    >> dim lol as string
    >> lol="Carl"
    >> ....
    >>
    >>
    >> In test.aspx, i want to have: hello Carl
    >> So i did:
    >> <form id="form1" runat="server">
    >> <asp:Label Runat="server">Hello <%=lol%></asp:Label>
    >>
    >>
    >> But i get the error: "Name 'lol' is not declared"
    >>
    >> Thanks
    >>
    >>

    >
    >
     
    Manikandan, May 12, 2006
    #4
  5. Chris

    Guest

    y dont u assign the value in code behind file like
    Label1.Text=lol;
     
    , May 15, 2006
    #5
    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. Chris
    Replies:
    1
    Views:
    668
    Chris
    May 11, 2006
  2. Tricky
    Replies:
    0
    Views:
    580
    Tricky
    Mar 19, 2009
  3. Tricky
    Replies:
    0
    Views:
    1,007
    Tricky
    Mar 19, 2009
  4. Reuven
    Replies:
    0
    Views:
    596
    Reuven
    Mar 19, 2009
  5. timr
    Replies:
    2
    Views:
    166
Loading...

Share This Page