Hidden values

Discussion in 'ASP .Net' started by Roshawn Dawson, Mar 24, 2005.

  1. Hi,

    Is it possible to pass the value of a hidden field in the querystring?
    If not, how can you pass the value from page to page without using
    server controls?

    Thanks,
    Roshawn
    Roshawn Dawson, Mar 24, 2005
    #1
    1. Advertising

  2. Roshawn Dawson

    BillGatesFan Guest

    You can use Session Variables
    BillGatesFan, Mar 24, 2005
    #2
    1. Advertising

  3. Hi Roshawn,

    Here's a way to pass values from one page to another without the messy
    querystring.

    You can pass Context and then use Server.Transfer. The code below shows the
    starting page first and then the receiver page.

    Let us know if this helps?

    Ken
    Microsoft MVP [ASP.NET]


    ' Page with hidden textbox:

    <form id="Form1" method="post" runat="server">
    <p>
    <asp:textbox id="TextBox1" runat="server"
    visible="False">Pass this!</asp:textbox></p>
    <p>
    <asp:button id="Button1" runat="server"
    Text="Button"></asp:button></p>
    </form>

    Private Sub Button1_Click _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    Context.Items("txtValue") = TextBox1.Text
    Server.Transfer("targetpg.aspx")
    End Sub


    ' targetpg.aspx that shows the passed value

    <form id="Form1" method="post" runat="server">
    <asp:label id="Label1" runat="server">Label</asp:label>
    </form>

    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    Label1.Text = CType(Context.Items("txtValue"), String)
    End Sub

    "Roshawn Dawson" <> wrote in message
    news:...
    > Hi,
    >
    > Is it possible to pass the value of a hidden field in the querystring? If
    > not, how can you pass the value from page to page without using server
    > controls?
    >
    > Thanks,
    > Roshawn
    Ken Cox [Microsoft MVP], Mar 25, 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. Rajesh

    Hidden textbox values lost!!

    Rajesh, Sep 5, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,438
    Rajesh.V
    Sep 10, 2003
  2. Jeremy Ames

    Changing hidden values

    Jeremy Ames, May 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,464
    Charlie@CBFC
    May 5, 2004
  3. Jukka K. Korpela
    Replies:
    1
    Views:
    1,109
    Jonathan N. Little
    Sep 12, 2006
  4. Rick
    Replies:
    3
    Views:
    8,101
    Alexey Smirnov
    Apr 13, 2010
  5. SolarCanine
    Replies:
    2
    Views:
    253
    SolarCanine
    Sep 20, 2005
Loading...

Share This Page