-
Accessing hidden variables through javascript in the code behind file
I've been trying to invoke a javascript in my code behind. This script should be invoked only when a condition (tested on the web server) is satisfied. The javascript should throw up a confirm box, and I need to find out if the user clicked OK or Cancel in my code behind file. How can this be done? Here's a snippet of the code I'm using at the moment...
if (savedInd.Value.Equals("false"))
{
ProjectFinder1.Navigate = false;
string test = "<script language=javascript>"+
" { "+
" if(confirm('You will lose any changes made. Do you wish to continue?')) "+
" { "+
//" document.getElementById('" + clickInd.ClientID + "').value = 'true'; "+
" document.all[" + clickInd.ClientID +"].value = 'true';"+
" alert(document.all[" + clickInd.ClientID +"].value); "+
" } "+
" else "+
" { "+
" document.all[" + clickInd.ClientID +"].value = 'false'; "+
" alert(document.all[" + clickInd.ClientID +"].value); "+
" } "+
" } "+
" </script> ";
Response.Write(test);
}
Is there any way I can trap what the user clicked? Someone please let me know if there's a solution to this. I can't trigger this javascript on click of a button since this button exists in a user control, or at least that's the impression I have. Correct me if I'm wrong.
Atith
-
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Similar Threads
-
By supratimmaiti in forum Java
Replies: 1
Last Post: 07-09-2005, 12:09 AM
-
By Sharky01276 in forum Java
Replies: 1
Last Post: 05-17-2005, 12:43 PM
-
By jase_dukerider in forum C++
Replies: 2
Last Post: 04-14-2005, 07:48 PM
-
By Murray Foxcroft in forum Web
Replies: 5
Last Post: 11-02-2000, 02:42 AM
-
By james chung in forum Web
Replies: 0
Last Post: 09-16-2000, 02:41 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks