473,382 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

returning values from modal dialog boxes in asp.net

If i have a window showing like this

<script>window.showModalDialog('../weblinks/default.aspx','','unadorned:yes'
);</script>

how can i get it to return a value to its calling page? I want to have a
list of values to click in the modal dialog box, and when they click on one
of the values it closes the window and returns the value to the calling
page. How would you do this in ASP.NET? thanks! (i need to use the value in
the asp.net page also once it's returned)
Nov 18 '05 #1
2 2710
Easiest way would be to set a session variable, for example:

Session("pass_this") = lstSelect.SelectedItem.Text (or .Value if
your prefer)

Then refer to the session variable from any aspx page.

You could also pass it in a querystring or a form collection.

hth,

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Brian,
on the modal page you can also add an onclick event to your ok and cancel
buttons. Then you can add some javascript like this

function doOK(myvariable) {
window.returnValue = myvariable;
window.close();
}
function doCancel() {
window.returnValue = "";
window.close();
}

then in the receiving page you set the window to a variable like this

var str =
window.showModalDialog('../weblinks/default.aspx','','unadorned:yes'
);
then test the str results

if (!str)
str = "";

if (str.length == 0)
{
return;
}
else
{
.....perform some actions
....force postback
}

HTH

Jose
"Brian Henry" <no************@adelphia.net> wrote in message
news:uq**************@TK2MSFTNGP11.phx.gbl... If i have a window showing like this

<script>window.showModalDialog('../weblinks/default.aspx','','unadorned:yes' );</script>

how can i get it to return a value to its calling page? I want to have a
list of values to click in the modal dialog box, and when they click on one of the values it closes the window and returns the value to the calling
page. How would you do this in ASP.NET? thanks! (i need to use the value in the asp.net page also once it's returned)

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nonoy of Philippines | last post by:
Hello, guys... I'm just starting to develop web applications and I have this problem regarding Session objects At some parts of my application, I open modal dialog window which also opens...
1
by: Laxmikant Rashinkar | last post by:
Hello, from inside a button handler, I am launching a dialog box that contains lables and text boxes. The dialog box is launched using dlg.Show(). In this situation the contents of the text...
3
by: Andrew Baker | last post by:
OK this has me perplexed, puzzled and bamboozled! I have a remoting service which I displayed a message box in. I then wondered what would happen if a client made a call to the service while the...
2
by: barney | last post by:
Hi Folks, One of the users running our web application is reporting that in modal dialog boxes, they can only see half the content. It seems that even though I have explicitly set font sizes...
0
by: adam | last post by:
I'm writing an Intranet application that uses Modal Dialog boxes and have embedded a page within an iframe on another page that is opened modally, so that the postbacks work as normal. When...
4
by: mpreston | last post by:
I'm following the example from the MSDN library on how to create modal dialog boxes in C#, but something isn't working properly. If I create a modal dialog box and show it using ShowDialog(), the...
2
by: one.1more | last post by:
I want to make a text game using javascript dialog boxes. i learned about confirm boxes but its not helpful(http:// www.javascriptmall.com/learn/lesson6.htm) 1. for ex, in the confirm boxes,...
11
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
10
by: brendanmcdonagh | last post by:
Hi all, I'm just getting to grips with java and have set my self a challenge to consolidate my learnings so far as well as implement new learnings. I want to enter a load of possible things to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.