Hello Allideliner!!!

I am having problem in retrives values from textbox at aspx page to popup page?
aspx page code:
one textbox--

<asp:TextBox ID="txtTopicTitle" 
          runat="server"  style="height:25px"></asp:TextBox>

I want to use this txtTopicTitle values on the popup page(Default.aspx page )..
Then what is the process require??
I hope somebody able to helpful me......

Dani AI

Generated

Good summary of the goal: show a “preview” popup that renders the values entered in the parent page’s user control (title, summary, description, date). and pointed out QueryString, and mentioned Session — both work but have important limits (length/exposure for query strings; server memory and web‑farm issues for sessions). Three practical, modern options follow (pick one that fits your deployment and security needs).

  1. Recommended — window.postMessage (robust, no server storage)
  • Parent opens the popup on a user click, then posts the data once the popup signals it is ready.

  • Parent (JS):

    // run inside click handler
    var popup = window.open('/Preview.aspx', 'preview', 'width=900,height=700');
    window.addEventListener('message', function recv(e) {
      if (e.origin !== location.origin) return;
      if (e.data === 'previewReady') {
        window.removeEventListener('message', recv);
        popup.postMessage({
          title: document.getElementById('TITLE_CLIENT_ID').value,
          summary: document.getElementById('SUMMARY_CLIENT_ID').value,
          body: document.getElementById('BODY_CLIENT_ID').value
        }, location.origin);
      }
    });
  • Popup (JS):

    window.onload = function() {
      if (window.opener) window.opener.postMessage('previewReady', location.origin);
    };
    window.addEventListener('message', function(e) {
      if (e.origin !== location.origin) return;
      var d = e.data;
      document.getElementById('previewTitle').textContent = d.title || '';
      // populate other preview elements...
    });

Notes: replace the CLIENT_ID placeholders with the rendered ClientID for your controls. Always check e.origin before accepting messages.

  1. Server-side temp storage (good for large content or when you want server rendering)
  • On click, save the form payload into Cache/DB with a GUID key, open Preview.aspx?key=GUID, and have Preview.aspx load the payload by key and expire it after a few minutes. This keeps payload out of URL and avoids large query strings.
  1. Simple same-origin option — localStorage
  • Parent: write JSON to localStorage then open popup.
  • Popup: read and clear that key on load. Quick and works when both pages share the same origin, but avoid for sensitive data (it persists until removed).

Troubleshooting tips

  • Always open popup from a direct user action (click) to avoid popup blockers.
  • If controls are inside a user control, use their ClientID (emit them into JS from server code) so the correct element is read.
  • Clean up temporary data (localStorage/cache) to avoid stale previews.
  • For web farms, prefer a distributed cache or DB rather than in‑process session/cache.

This gives a secure, practical preview workflow without duplicating the session/querystring pitfalls mentioned earlier.

Recommended Answers

All 6 Replies

:confused:

You may check the following thread:
http://forums.asp.net/t/1231461.aspx

Hope it helps.

Ya sir . some thing that is used me in my problem..
but u r not getting me . acutally

I created one page Default.aspx contains one textbox.
and when user fire button clck the textbox value is dispaly on pop up page(another page dispaly at front of parent page)..

Ya Sir ,U r right. to say for querystring..
But actually
I am using popup for displaying preview of new forumpost on button click...
and this preveiw page has so many things like,

Title,Summary, description.,Date...
So it shouldn't proper way to use querystring..

one thing Also I want to clarify that is..
" Text boxes that used for title,summary,description on parent page are acually one usercontrol.(All textboxes are on this usercontrol and i used this usecontrol in this parent page)

and now i want on preview click popup page will display and
that show the look of your forum..

I hope U will got idea as U all r experience persons. and at least one of U will guide me..
Thanks for above all reply to me..

You can use Query String to pass a data beween the parent page and the popup window.

Check these links.

Passing variables between pages using QueryString
How to: Pass Values Between ASP.NET Web Pages

Check the following 2 articles and see if they are helpful:

Thanks.

Use sessions;

think that there is one text box in parent page;

create session for that;

session["Textbox"]=textbox1.text.toString();

i think tat it may help u;;\

All the Best;;; and Best of Luck;;;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.