how to make popup window active
-
hi iam having a aspx page which contains a textbox and a button.i have written javascript code for passing values between a popup window and the parent(aspx)page.upto this everything works fine.after taking value from pop up window i want to make the pop up window active(that is parent window should not be clicked unless pop up window closes.)but in my case the pop up window gets minimised when i click outside in the parent window.and one more problem with the page is it gets minimised when i click outside the window. iam giving the javascript code here for your reference. function to open pop up window.. string scr = @"<script> function update(elemValue) { document.getElementById('ctl00_LondonContentPlaceHolder3_txtRestName').innerText=elemValue[0]; } </script>"; // register the javascript into the Page Page.RegisterClientScriptBlock("update", scr); //add our popup onclick attribute to the desired element on the page (Here, Hyperlink1) lnkTopPick.Attributes.Add("onclick", "window.open('lrs_SearchRestToppick.aspx',null,'left=190, top=225, height=250, width= 465, status=n o, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');"); function to pass value protected void Page_Load(object sender, EventArgs e) { string scr = @" <script> function Done() { var RestName=document.getElementById('txtRestName').value; var RestDesc=document.getElementById('txtRestDesc').value; var ret= new Array(RestName,RestDesc); window.opener.update(ret); window.close(); } </script>"; Page.RegisterClientScriptBlock("done", scr); }
pintoo
-
hi iam having a aspx page which contains a textbox and a button.i have written javascript code for passing values between a popup window and the parent(aspx)page.upto this everything works fine.after taking value from pop up window i want to make the pop up window active(that is parent window should not be clicked unless pop up window closes.)but in my case the pop up window gets minimised when i click outside in the parent window.and one more problem with the page is it gets minimised when i click outside the window. iam giving the javascript code here for your reference. function to open pop up window.. string scr = @"<script> function update(elemValue) { document.getElementById('ctl00_LondonContentPlaceHolder3_txtRestName').innerText=elemValue[0]; } </script>"; // register the javascript into the Page Page.RegisterClientScriptBlock("update", scr); //add our popup onclick attribute to the desired element on the page (Here, Hyperlink1) lnkTopPick.Attributes.Add("onclick", "window.open('lrs_SearchRestToppick.aspx',null,'left=190, top=225, height=250, width= 465, status=n o, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');"); function to pass value protected void Page_Load(object sender, EventArgs e) { string scr = @" <script> function Done() { var RestName=document.getElementById('txtRestName').value; var RestDesc=document.getElementById('txtRestDesc').value; var ret= new Array(RestName,RestDesc); window.opener.update(ret); window.close(); } </script>"; Page.RegisterClientScriptBlock("done", scr); }
pintoo
chithra.r wrote:
parent window should not be clicked unless pop up window closes
Did you consider using ShowModalDialog?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
chithra.r wrote:
parent window should not be clicked unless pop up window closes
Did you consider using ShowModalDialog?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
yep..i have tried showmodal dialog also..but it is not working...the thing is the pop up window get minimized when i click outside (in the parent window),which means it is not active.
pintoo
It can not. When a ShowModalDialog is shown, the parent window is not clickable at all. Check out this page which has an example: http://msdn2.microsoft.com/en-us/library/ms536759(VS.85).aspx[^]
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson