DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    1

    Unhappy 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

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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

  1. java code for file uploading
    By supratimmaiti in forum Java
    Replies: 1
    Last Post: 07-09-2005, 12:09 AM
  2. Text file to line of code????
    By Sharky01276 in forum Java
    Replies: 1
    Last Post: 05-17-2005, 12:43 PM
  3. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 07:48 PM
  4. Sample Sites.
    By Murray Foxcroft in forum Web
    Replies: 5
    Last Post: 11-02-2000, 02:42 AM
  5. Replies: 0
    Last Post: 09-16-2000, 02:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links