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. Take value from javascript function in aspx's html side to aspx.cs

Take value from javascript function in aspx's html side to aspx.cs

Scheduled Pinned Locked Moved ASP.NET
questionjavascripthtmltoolshelp
5 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 Offline
    B Offline
    bijeshputhalath
    wrote on last edited by
    #1

    Hai friends, I hava a javascript function like this in aspx page's html side. 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"]%>'; } I need to take the value from this scipt function into aspx.cs page.what I need to do for that?I write in Pageload event that btn_checkout.Attributes.Add("OnClick", "javascript:calculate()"); But while clicking the button btn_checkout nothing is happend.What wrong with my code.Please give any solution.How can i take value from html side to aspx.cs page.and also check if any mistake in my script.....Please help. Thanks Bijesh

    S J 2 Replies Last reply
    0
    • B bijeshputhalath

      Hai friends, I hava a javascript function like this in aspx page's html side. 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"]%>'; } I need to take the value from this scipt function into aspx.cs page.what I need to do for that?I write in Pageload event that btn_checkout.Attributes.Add("OnClick", "javascript:calculate()"); But while clicking the button btn_checkout nothing is happend.What wrong with my code.Please give any solution.How can i take value from html side to aspx.cs page.and also check if any mistake in my script.....Please help. Thanks Bijesh

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      Use Hidden field and make it run at server access this hidden field by using its id and assign the value

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      B 1 Reply Last reply
      0
      • S Sandeep Akhare

        Use Hidden field and make it run at server access this hidden field by using its id and assign the value

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

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

        Hi, Thanks for ur reply. Please give some sample code .How assign to hidden field and take the values to aspx.cs part. Thanks agaain, Bijesh

        1 Reply Last reply
        0
        • B bijeshputhalath

          Hai friends, I hava a javascript function like this in aspx page's html side. 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"]%>'; } I need to take the value from this scipt function into aspx.cs page.what I need to do for that?I write in Pageload event that btn_checkout.Attributes.Add("OnClick", "javascript:calculate()"); But while clicking the button btn_checkout nothing is happend.What wrong with my code.Please give any solution.How can i take value from html side to aspx.cs page.and also check if any mistake in my script.....Please help. Thanks Bijesh

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

          Are U getting values into amount?? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On load in .aspx onload="setThankMessage(); in .aspx.cs page function setThankMessage() { document.getElementById('relationship').value = '<%=Session["hydPatientRelatnshipPR"]%>'; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~JJ

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

          B 1 Reply Last reply
          0
          • J Jagadeesh Jupalli

            Are U getting values into amount?? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On load in .aspx onload="setThankMessage(); in .aspx.cs page function setThankMessage() { document.getElementById('relationship').value = '<%=Session["hydPatientRelatnshipPR"]%>'; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~JJ

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

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

            hello, I got the value,it is printing in form.but i need it in any label or text box controls. Thanks Bijesh

            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