Avatar of smithmrk
smithmrk
Flag 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?

Thanks,
Mark
ASP.NET

Avatar of undefined
Last Comment
smithmrk

8/22/2022 - Mon
Kumaraswamy R

Hi

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

-as of my understanding Bellow URl Help U

http://forums.devx.com/showthread.php?threadid=143380
smithmrk

ASKER
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_;
  else
    return qs[1];
}

Open in new window

A.jpg
smithmrk

ASKER
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!

Thanks,
Mark
B.jpg
C.jpg
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Albert Van Halen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Member_2_4913559

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.
smithmrk

ASKER
That worked perfect!!!!

Thanks,
Mark