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. javascript funtion

javascript funtion

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptquestion
11 Posts 3 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.
  • B bijeshputhalath

    Hi , I have try to get the value of a javascript funtion.The result displayed on the aspx form.My problem is that I cant get the value in aspx.cs part. I have some code like this in aspx page document.getElementById("lblop").innerText = currency_show_conversion(document.getElementById("lbl_netamt").innerText,"INR","USD"); in lblop the value is printing. but i try in aspx.cs that, string abc=lblop.Text Nothing is get....What things wrong in my code? please help me Thanks in advance, Bijesh

    W Offline
    W Offline
    www Developerof NET
    wrote on last edited by
    #2

    You have to store the value that u are assigning to the label in a hidden field and access that hidden field in ur code.

    When you fail to plan, you are planning to fail.

    J B 2 Replies Last reply
    0
    • W www Developerof NET

      You have to store the value that u are assigning to the label in a hidden field and access that hidden field in ur code.

      When you fail to plan, you are planning to fail.

      J Offline
      J Offline
      Jagadeesh Jupalli
      wrote on last edited by
      #3

      We can also use session variables here......

      B 1 Reply Last reply
      0
      • W www Developerof NET

        You have to store the value that u are assigning to the label in a hidden field and access that hidden field in ur code.

        When you fail to plan, you are planning to fail.

        B Offline
        B Offline
        bijeshputhalath
        wrote on last edited by
        #4

        Hi, Please give some sample code for how assigning hiddenfield to the label and how used it in code.... Thanks Bijesh

        W 1 Reply Last reply
        0
        • J Jagadeesh Jupalli

          We can also use session variables here......

          B Offline
          B Offline
          bijeshputhalath
          wrote on last edited by
          #5

          Hi, Thanks for your reply. But I dont know how to use session here.Please give any sample code. Regards Bijesh

          J 1 Reply Last reply
          0
          • B bijeshputhalath

            Hi, Thanks for your reply. But I dont know how to use session here.Please give any sample code. Regards Bijesh

            J Offline
            J Offline
            Jagadeesh Jupalli
            wrote on last edited by
            #6

            example of using session variables in Java Script function showThankyouMsg(){ var imgwidth, imgheight, messhead, mess1, mess2, mess3, divleft, messageType; var strCancelCheckIn = '<%=Session["AgreeYN"]%>'; var strPaymentOption = '<%=Session["paymenttype"]%>'; var visitInfoCorrectYes = '<%=Session["visitInfoCorrectYes"]%>'; var strcopayamount = '<%=Session["copayamount"]%>'; var strprimaryins = '<%=Session["primaryins"]%>'; var strcopaytransfail = '<%=Session["copaytransaction"]%>'; var SpeakToStaff = '<%=Session["hydSpkToStaff"]%>'; var paytype = '<%=Session["paymenttypeCash"]%>'; .................... }

            My Blogs... .Net Interview Questions
            All about my Online Trading

            J B 2 Replies Last reply
            0
            • J Jagadeesh Jupalli

              example of using session variables in Java Script function showThankyouMsg(){ var imgwidth, imgheight, messhead, mess1, mess2, mess3, divleft, messageType; var strCancelCheckIn = '<%=Session["AgreeYN"]%>'; var strPaymentOption = '<%=Session["paymenttype"]%>'; var visitInfoCorrectYes = '<%=Session["visitInfoCorrectYes"]%>'; var strcopayamount = '<%=Session["copayamount"]%>'; var strprimaryins = '<%=Session["primaryins"]%>'; var strcopaytransfail = '<%=Session["copaytransaction"]%>'; var SpeakToStaff = '<%=Session["hydSpkToStaff"]%>'; var paytype = '<%=Session["paymenttypeCash"]%>'; .................... }

              My Blogs... .Net Interview Questions
              All about my Online Trading

              J Offline
              J Offline
              Jagadeesh Jupalli
              wrote on last edited by
              #7

              take the value like this var strSessionValues = document.getElementById('divSessionValues').innerText; and assign it to the session variable....

              My Blogs... .Net Interview Questions
              All about my Online Trading

              1 Reply Last reply
              0
              • J Jagadeesh Jupalli

                example of using session variables in Java Script function showThankyouMsg(){ var imgwidth, imgheight, messhead, mess1, mess2, mess3, divleft, messageType; var strCancelCheckIn = '<%=Session["AgreeYN"]%>'; var strPaymentOption = '<%=Session["paymenttype"]%>'; var visitInfoCorrectYes = '<%=Session["visitInfoCorrectYes"]%>'; var strcopayamount = '<%=Session["copayamount"]%>'; var strprimaryins = '<%=Session["primaryins"]%>'; var strcopaytransfail = '<%=Session["copaytransaction"]%>'; var SpeakToStaff = '<%=Session["hydSpkToStaff"]%>'; var paytype = '<%=Session["paymenttypeCash"]%>'; .................... }

                My Blogs... .Net Interview Questions
                All about my Online Trading

                B Offline
                B Offline
                bijeshputhalath
                wrote on last edited by
                #8

                Hi, ok.How i connect this with my coding?pls go through my first post.where i put session state and I need to assign the label value to session.but here session is assign to a varriable.How I take the value in aspx.cs? Please give some details. Thanks again, Bijesh

                J 1 Reply Last reply
                0
                • B bijeshputhalath

                  Hi, ok.How i connect this with my coding?pls go through my first post.where i put session state and I need to assign the label value to session.but here session is assign to a varriable.How I take the value in aspx.cs? Please give some details. Thanks again, Bijesh

                  J Offline
                  J Offline
                  Jagadeesh Jupalli
                  wrote on last edited by
                  #9

                  You had a value in JavaScript and want to display it in a label as well as pass it to .aspx.cs file Right?? Write a Separate JavaScript function for that 1. First calculate the value and Place it in the session (use can use above) 2. assign it to the label using (document.getElementById("lblBirthDate").value = '<%=Session["birthdate"]%>';) 3. Call this function on pageload or button click... ~JJ

                  My Blogs... .Net Interview Questions
                  All about my Online Trading

                  B 1 Reply Last reply
                  0
                  • J Jagadeesh Jupalli

                    You had a value in JavaScript and want to display it in a label as well as pass it to .aspx.cs file Right?? Write a Separate JavaScript function for that 1. First calculate the value and Place it in the session (use can use above) 2. assign it to the label using (document.getElementById("lblBirthDate").value = '<%=Session["birthdate"]%>';) 3. Call this function on pageload or button click... ~JJ

                    My Blogs... .Net Interview Questions
                    All about my Online Trading

                    B Offline
                    B Offline
                    bijeshputhalath
                    wrote on last edited by
                    #10

                    Hai, I write the function like this. function calculate() { alert('welcome'); document.getElementById("<%=lbl_netamount.ClientID%>").innerText = currency_show_conversion(document.getElementById("lbl_netamt").innerText,"INR","USD"); var amount= document.getElementById("<%=lbl_netamount.ClientID%>").innerText; '<%=Session["Amount"]%>'=amount; document.getElementById("lbl_netamount").value = '<%=Session["Amount"]%>'; } How I call it in aspx.cs page?? Thanks Bijesh

                    1 Reply Last reply
                    0
                    • B bijeshputhalath

                      Hi, Please give some sample code for how assigning hiddenfield to the label and how used it in code.... Thanks Bijesh

                      W Offline
                      W Offline
                      www Developerof NET
                      wrote on last edited by
                      #11

                      bijeshputhalath wrote:

                      document.getElementById("lblop").innerText = currency_show_conversion(document.getElementById("lbl_netamt").innerText,"INR","USD");

                      drop in a hidden field on to ur UI, set an ID for it for eg:Hid1 and in javascript wtite the following code document.getElementById("Hid1").value=currency_show_conversion(document.getElementById("lbl_netamt").innerText,"INR","USD"); and now wherevever u need to acces this value in code behind, use String currency=Hid1.value; and currency has the value returned by the javascript function.

                      When you fail to plan, you are planning to fail.

                      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