Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh after showmodal

Status
Not open for further replies.

Miclis

Programmer
Jan 27, 2005
14
0
0
NO
I have a aspx-page (Y) and I use showmodal to open a window (X)where the user can choose a value. The value comes in a textbox on page Y and the window X closes again.
It works perfect, but after this my page Y every time looks like to refresh. And that is wat I don't want.
Showmodal i a script:
function GoLookSomething(t1,t2)
{
//declare a object variable
var retval = new Object();
//show modal dialog box and collect its return value
retval=window.showModalDialog
("LU_Something.aspx",window,
"DialogHeight=500px; Toolbar=no; Titlebar=no; DialogWidth=640px; Center=yes;"+
"Status=no; Resizable=yes; Scrolling=yes; Help=no;");
//check if user closed the dialog
//without selecting any value
if(retval!=null)
{
//fill the textbox(es) with selected value
document.getElementById(t1).value=retval.Val1;
document.getElementById(t2).value=retval.Val2;
}
}
Who knows how I can stop this refereshing/postback.
 
do a return false in your javascript function that launches the Modal...

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Wow! That was a fast ansver. Tanks, but... "do a return false..." ..OK, how can I do this. How does it looks like?
 
This "return false", should I put it in the "OnClick" of the button who lauches the Modal?

bButton.Attributes.Add("OnClick", "GoLookSomething('tbOne','tbTwo'); Return=false; ");
 
exactly...or like this...

javascript
Code:
function GoLookSomething(t1,t2)
{
  //declare a object variable
  var retval = new Object();
  //show modal dialog box and collect its return value
  retval=window.showModalDialog
  ("LU_Something.aspx",window,
  "DialogHeight=500px; Toolbar=no; Titlebar=no;    DialogWidth=640px; Center=yes;"+
  "Status=no; Resizable=yes; Scrolling=yes; Help=no;");
  //check if user closed the dialog 
  //without selecting any value
  if(retval!=null)
  {
    //fill the textbox(es) with selected value
    document.getElementById(t1).value=retval.Val1;
    document.getElementById(t2).value=retval.Val2;
  }
 return false;
}

Code:
bButton.Attributes.Add("OnClick", "return GoLookSomething('tbOne','tbTwo');");

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
It works!
Thank you so much for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top