views:

59

answers:

3

Using C#,

I want to get a value from previous page.

For example,

In a page A i have the textbox value like "apple", i want to get the same value in page B

Page A Code.

 <a href="javascript:void(0)"
    onclick="window.open('pageB.aspx',
    'Add','width=700,height=400')">
    Add</a>

Above Code is linking a Page B from Page A

How to get a value page A textbox value in Page B.

Need Help

A: 

You maybe can store it in a Session-variable?

Here you can find some more information: http://kb2.adobe.com/cps/165/tn_16563.html

Kristof DB
+1  A: 

Why don't you just pass the value as a parameter in your call to open pageB.aspx?

<a href="javascript:void(0)"
    onclick="window.open('pageB.aspx?param=' +
 document.getElementById('textBoxFromPageA').value,
        'Add','width=700,height=400')">
        Add</a>

This will generate the URL of pageB.aspx?param=Apple. Then on the pageB.aspx code behind, you can access that value using the Request("param") call.

Tommy
A: 

As an alternative to query string or session consider using the PreviousPage property or using server.transfer and then getting a handle to the previous page through context.handler.

Doing this is beneficial in that session is not utilised needlessly and query string parameters: visible, editable, hackable by all of the world are not used.

brumScouse