value from html control to asp.net control through javascript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • royal ludhiana
    New Member
    • Jan 2008
    • 11

    value from html control to asp.net control through javascript?

    hi all,

    I want to pass the value from a html control(input.. .text) to asp.net control(textbox ). And this should happen...whenev er the html control receives a value(don't want to use a button click event). How this can be possible. I don't want to make a html control as sever control(by adding... runat="server") .

    Regards,

    Royal
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use the onchange event instead.

    What does the ASP.NET control look like (the source code on the client-side)?

    Comment

    • royal ludhiana
      New Member
      • Jan 2008
      • 11

      #3
      Originally posted by acoder
      Use the onchange event instead.

      What does the ASP.NET control look like (the source code on the client-side)?
      I am using a normal asp.net textbox.

      <asp:TextBox id="TextBox1" runat="server"> </asp:TextBox>

      can you let me know how this going to work. I am new to javascript.

      Regards,

      Royal

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        What's the id of the textbox on the client-side? View Source in the browser.

        Comment

        • royal ludhiana
          New Member
          • Jan 2008
          • 11

          #5
          Originally posted by acoder
          What's the id of the textbox on the client-side? View Source in the browser.
          Following are the two controls I am using:

          <input id="txtdt" type="text" name="caldt"" />
          <asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>

          Whenever the html control receives a value the same should be displayed in the asp.net control. I don't want to use "runat= "server" " with the html control and also i don't want to code anything on click of a button.

          Regards,

          Royal

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by royal ludhiana
            Following are the two controls I am using:

            <input id="txtdt" type="text" name="caldt"" />
            <asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>

            Whenever the html control receives a value the same should be displayed in the asp.net control. I don't want to use "runat= "server" " with the html control and also i don't want to code anything on click of a button.
            I know that's what it looks like in ASP.NET, but what does it look like in HTML? If you load the page containing this code and view the source by choosing View Source from the menu or by right-clicking, you will see that the code is different on the client-side.

            Comment

            • royal ludhiana
              New Member
              • Jan 2008
              • 11

              #7
              Originally posted by acoder
              I know that's what it looks like in ASP.NET, but what does it look like in HTML? If you load the page containing this code and view the source by choosing View Source from the menu or by right-clicking, you will see that the code is different on the client-side.
              Basically I am putting these controls on a web user control. So you won't be able to see the code on execution.

              Royal

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by royal ludhiana
                Basically I am putting these controls on a web user control. So you won't be able to see the code on execution.
                I'm not sure what you mean by a web user control, but the browser will show the source code on the client-side. View source in the browser - what does it show for the page?

                Comment

                Working...