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. how to detect session in javascript?

how to detect session in javascript?

Scheduled Pinned Locked Moved ASP.NET
javascripttutorialquestion
4 Posts 4 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.
  • H Offline
    H Offline
    hardyyanto
    wrote on last edited by
    #1

    hello every one... i can use label and textbox in javascript, and now, i am using session, but can not detect in javascript. my javascript: function DisplayConfirmation(cost,textboxid) { var s=document.getElementById(textboxid).value; if(s>cost) { if(confirm('Are u sure')) { document.getElementById('<%=HiddenField1.ClientID%>').value = "true" } else { document.getElementById("<%=HiddenField1.ClientID%>").value = 'false' } } else { } } my code in vb: Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound If Page.IsPostBack = True Then Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox) Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label) Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button) b.Attributes.Add("onclick", "return DisplayConfirmation(" & l1.Text & ",'" & t2.ClientID & "')") End If End Sub the label and textbox can detect in javascript... but if i use session, it can not detect in javascript. i don't know about the true code... my code use session like this: Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound If Page.IsPostBack = True Then Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox) Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label) Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button) Session("l") = l1 b.Attributes.Add("onclick", "return DisplayConfirmation(" & Session("l").tostring & ",'" & t2.ClientID & "')") End If End Sub it can not detect... what should i change it? thx..

    P K 2 Replies Last reply
    0
    • H hardyyanto

      hello every one... i can use label and textbox in javascript, and now, i am using session, but can not detect in javascript. my javascript: function DisplayConfirmation(cost,textboxid) { var s=document.getElementById(textboxid).value; if(s>cost) { if(confirm('Are u sure')) { document.getElementById('<%=HiddenField1.ClientID%>').value = "true" } else { document.getElementById("<%=HiddenField1.ClientID%>").value = 'false' } } else { } } my code in vb: Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound If Page.IsPostBack = True Then Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox) Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label) Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button) b.Attributes.Add("onclick", "return DisplayConfirmation(" & l1.Text & ",'" & t2.ClientID & "')") End If End Sub the label and textbox can detect in javascript... but if i use session, it can not detect in javascript. i don't know about the true code... my code use session like this: Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound If Page.IsPostBack = True Then Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox) Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label) Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button) Session("l") = l1 b.Attributes.Add("onclick", "return DisplayConfirmation(" & Session("l").tostring & ",'" & t2.ClientID & "')") End If End Sub it can not detect... what should i change it? thx..

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      WTF?

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      V 1 Reply Last reply
      0
      • P pmarfleet

        WTF?

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        Keep watching. I wouldn't get surprised if his next query would be how to create a web server in Internet Explorer and run a JavaScript webpage in IIS?

        Vasudevan Deepak Kumar Personal Homepage
        Tech Gossips
        A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

        1 Reply Last reply
        0
        • H hardyyanto

          hello every one... i can use label and textbox in javascript, and now, i am using session, but can not detect in javascript. my javascript: function DisplayConfirmation(cost,textboxid) { var s=document.getElementById(textboxid).value; if(s>cost) { if(confirm('Are u sure')) { document.getElementById('<%=HiddenField1.ClientID%>').value = "true" } else { document.getElementById("<%=HiddenField1.ClientID%>").value = 'false' } } else { } } my code in vb: Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound If Page.IsPostBack = True Then Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox) Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label) Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button) b.Attributes.Add("onclick", "return DisplayConfirmation(" & l1.Text & ",'" & t2.ClientID & "')") End If End Sub the label and textbox can detect in javascript... but if i use session, it can not detect in javascript. i don't know about the true code... my code use session like this: Protected Sub FormView2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView2.DataBound If Page.IsPostBack = True Then Dim t2 As TextBox = TryCast(FormView2.FindControl("tes"), TextBox) Dim l1 As Label = TryCast(FormView2.FindControl("costLabel"), Label) Dim b As Button = TryCast(Me.FormView2.FindControl("button1"), Button) Session("l") = l1 b.Attributes.Add("onclick", "return DisplayConfirmation(" & Session("l").tostring & ",'" & t2.ClientID & "')") End If End Sub it can not detect... what should i change it? thx..

          K Offline
          K Offline
          kuwl_mark
          wrote on last edited by
          #4

          try this in javascript alert('<%=session("I")%>')

          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