Link to home
Create AccountLog in
Avatar of smithmrk
smithmrkFlag for United States of America

asked on

JavaScript Open Popup Window - Postback

OK, I have a JavaScript that opens a Popup Window and when first clicked it runs the Page_Load (Postback).

After I close the window and click it to open again, the 2nd time the Page_Load (Postback) does NOT work.  How can I force my LinkButton that runs the Popup Window to force the Page_Load (Postback) everytime?

Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image


Pl put Ur Code, then only we can get the where error we will know

-as of my understanding Bellow URl Help U
Avatar of smithmrk


I should have probably sent you some screen shots and code in the first post.
OK, I'm going to label the screen shots A, B, C so I can reference them for you better.
function TMA_Popup()
    var sitenum = getQuerystring('SiteNum');   
    var clntnum = document.getElementById('<%=txt_ClientNum.ClientID %>').value;
    window.showModalDialog('tma_codes.aspx?SiteNum=' + sitenum + '&ClientNum=' + clntnum,null,'height=450, width=450,status=no, resizable=no, scrollbars=yes, toolbar=no,location=no,menubar=no');
function getQuerystring(key, default_)
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
    return qs[1];

Open in new window

Opps, here are the rest of the screen shots..

OK So on screen shot "A" is the link button that runs the JavaScript that opens my Popup of codes "B".  Once the operator selects the codes they want they click OK and the codes are loaded to a database, and I close the window using JavaScript (window.close()).

If the operator made a mistake and want's to select more or remove one and they click the "A" link button again the popup window comes up...however it does NOT run the Page_Load "C" (IsPostBack = False).  How can I reset it so if the operator returns to this popup page it runs the PostBack again to update my codes based on what they checked or unchecked the first time?

Hope that helps!

Avatar of Albert Van Halen
Albert Van Halen
Flag of Netherlands image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
You're initial description of the problem is a little confusing, but after reading the follow up I would suggest that the approach is flawed.

Instead of using the page_load event and firing your Client_TMACodes() function based on the "PostBack" property you should attach an OnClick event to your linkbutton and fire your Client_TMACodes() function from inside of that event.

Or (and I dont know how the rest of your page functions) just remove the "call ClientTMA_Codes()" from the If postback = false statement and it will fire everytime.
That worked perfect!!!!