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. Java script?

Java script?

Scheduled Pinned Locked Moved ASP.NET
javajavascripttoolsquestion
11 Posts 5 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.
  • K Karthick_gc

    Hi friends, I want to pass the data to javascript function when click on the button. I write the code like this. Text="Button" /> In java script function function del(txt) { document.Write(txt); } But the answer came as NULL Can anyone correct it?

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #2

    <asp:button id="Button1" runat="server" onmousedown="del(document.getElementById('<%=TextBox1.ClientID%>'))"> The issue is that TextBox1, is not called TextBox1 on the client.

    Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

    K G 2 Replies Last reply
    0
    • C Christian Graus

      <asp:button id="Button1" runat="server" onmousedown="del(document.getElementById('<%=TextBox1.ClientID%>'))"> The issue is that TextBox1, is not called TextBox1 on the client.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      K Offline
      K Offline
      Karthick_gc
      wrote on last edited by
      #3

      Ok. I solve it. Is it possible to pass session variable inside the function?

      C A 2 Replies Last reply
      0
      • K Karthick_gc

        Ok. I solve it. Is it possible to pass session variable inside the function?

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        The session variable is on the server, you'd have to pass it to javascript by writing some script that defines a client side variable and sets it to the server side value. Don't forget to put it in quotes if it is a string.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        K 1 Reply Last reply
        0
        • C Christian Graus

          <asp:button id="Button1" runat="server" onmousedown="del(document.getElementById('<%=TextBox1.ClientID%>'))"> The issue is that TextBox1, is not called TextBox1 on the client.

          Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

          G Offline
          G Offline
          Greg Chelstowski
          wrote on last edited by
          #5

          Erm, I think you have to pass the TextBox1's value, surely, and not the whole control? I might be wrong, but that's what i gathered from the del(txt)function.

          var question = (_2b || !(_2b));

          1 Reply Last reply
          0
          • K Karthick_gc

            Ok. I solve it. Is it possible to pass session variable inside the function?

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #6

            Karthick_gc wrote:

            Is it possible to pass session variable inside the function?

            if it is already in session, then what is the use of pass it?

            cheers, Abhijit CodeProject MVP

            K 1 Reply Last reply
            0
            • A Abhijit Jana

              Karthick_gc wrote:

              Is it possible to pass session variable inside the function?

              if it is already in session, then what is the use of pass it?

              cheers, Abhijit CodeProject MVP

              K Offline
              K Offline
              Karthick_gc
              wrote on last edited by
              #7

              I want to check the session variable when the form is unload. I write the code like this. function del() { alert(Session["nam"]); } But the unload event is not trigerring. Whats the fault in this code?

              1 Reply Last reply
              0
              • C Christian Graus

                The session variable is on the server, you'd have to pass it to javascript by writing some script that defines a client side variable and sets it to the server side value. Don't forget to put it in quotes if it is a string.

                Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

                K Offline
                K Offline
                Karthick_gc
                wrote on last edited by
                #8

                Can u give the syntax for converion please?

                C 1 Reply Last reply
                0
                • K Karthick_gc

                  Hi friends, I want to pass the data to javascript function when click on the button. I write the code like this. Text="Button" /> In java script function function del(txt) { document.Write(txt); } But the answer came as NULL Can anyone correct it?

                  3 Offline
                  3 Offline
                  33258 28982 23601 22909
                  wrote on last edited by
                  #9

                  onmousedown="del(this.text)"

                  C 1 Reply Last reply
                  0
                  • 3 33258 28982 23601 22909

                    onmousedown="del(this.text)"

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #10

                    That would work, if the button he was clicking, was also the textbox he entered text into.

                    Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

                    1 Reply Last reply
                    0
                    • K Karthick_gc

                      Can u give the syntax for converion please?

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #11

                      var myClientsideString = '<=Session["key"]>'; inside a script block, obviously.

                      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

                      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