Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. catching return value from javascript function in asp.net code behind

catching return value from javascript function in asp.net code behind

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nettoolshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sandeep kumar pundhir
    wrote on last edited by
    #1

    hi, i m having a javascript function in my aspx.cs file as // To pop up confirmation box for dissociation function confirmdissociation () { if (confirm("Are you sure to perform this action?")==true) return true; else return false; } In code behind , i have bool getresult; Button1.Attributes("script","return confirmdissociation();"); I want to store the result retured from this in a bool variable getresult (declared in code behind) Please help sandeep

    D 1 Reply Last reply
    0
    • S sandeep kumar pundhir

      hi, i m having a javascript function in my aspx.cs file as // To pop up confirmation box for dissociation function confirmdissociation () { if (confirm("Are you sure to perform this action?")==true) return true; else return false; } In code behind , i have bool getresult; Button1.Attributes("script","return confirmdissociation();"); I want to store the result retured from this in a bool variable getresult (declared in code behind) Please help sandeep

      D Offline
      D Offline
      DIMPLE_R
      wrote on last edited by
      #2

      You can try something like this: Javascript Code: function confirmdissociation () { //alert("In Code"); if (confirm("Are you sure to perform this action?")==true) { document.getElementById("TextBox1").innerText ="true"; return true; } else { document.getElementById("TextBox1").innerText ="false"; return false; } } In Code Behind: private void Page_Load(object sender, System.EventArgs e) { Button1.Attributes.Add("onclick", "confirmdissociation();"); } --Dimple

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups