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. Can I access any Server control in Javascript function in .Net

Can I access any Server control in Javascript function in .Net

Scheduled Pinned Locked Moved ASP.NET
questioncsharpjavascriptcomsysadmin
6 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.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    1. I want to access a Server control in .net within a Javascript function. I used this method. alert(alter(document.getElementById('tbCmpName').id); still its not working. Can any body help me in accessing server side control from client side scripting? 2. How can I declare string variables in Javascript? 3. And one more question, how can I get the length of a string? Please reply me for these queries.

    S/W Engineer Akebono Soft Technologies aleem_abdul@akebonosoft.com.

    _ M 2 Replies Last reply
    0
    • I indian143

      1. I want to access a Server control in .net within a Javascript function. I used this method. alert(alter(document.getElementById('tbCmpName').id); still its not working. Can any body help me in accessing server side control from client side scripting? 2. How can I declare string variables in Javascript? 3. And one more question, how can I get the length of a string? Please reply me for these queries.

      S/W Engineer Akebono Soft Technologies aleem_abdul@akebonosoft.com.

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      indian143 wrote:

      I want to access a Server control in .net within a Javascript function. I used this method. alert(alter(document.getElementById('tbCmpName').id); still its not working.

      Like this you can access server control in javascript: document.getElementById('tbCmpName')

      indian143 wrote:

      2. How can I declare string variables in Javascript? 3. And one more question, how can I get the length of a string?

      This[^] with help you in that regard.

      Best Regards, Apurva Kaushal

      I 2 Replies Last reply
      0
      • _ _AK_

        indian143 wrote:

        I want to access a Server control in .net within a Javascript function. I used this method. alert(alter(document.getElementById('tbCmpName').id); still its not working.

        Like this you can access server control in javascript: document.getElementById('tbCmpName')

        indian143 wrote:

        2. How can I declare string variables in Javascript? 3. And one more question, how can I get the length of a string?

        This[^] with help you in that regard.

        Best Regards, Apurva Kaushal

        I Offline
        I Offline
        indian143
        wrote on last edited by
        #3

        No my dear, its not working, otherwise I would have triend on my own. I am stratly asking you that, I want to access the "Text" property of a server control. And I want to calculate its length and is its length is less than or = to "0" then I want to devalidate to page submission. How can I do it.

        S/W Engineer Akebono Soft Technologies aleem_abdul@akebonosoft.com.

        _ 1 Reply Last reply
        0
        • I indian143

          No my dear, its not working, otherwise I would have triend on my own. I am stratly asking you that, I want to access the "Text" property of a server control. And I want to calculate its length and is its length is less than or = to "0" then I want to devalidate to page submission. How can I do it.

          S/W Engineer Akebono Soft Technologies aleem_abdul@akebonosoft.com.

          _ Offline
          _ Offline
          _AK_
          wrote on last edited by
          #4

          I think in that case you can have a look at the reply given by KVishnupriya in your previous post. That will serve the purpose.

          Best Regards, Apurva Kaushal

          1 Reply Last reply
          0
          • I indian143

            1. I want to access a Server control in .net within a Javascript function. I used this method. alert(alter(document.getElementById('tbCmpName').id); still its not working. Can any body help me in accessing server side control from client side scripting? 2. How can I declare string variables in Javascript? 3. And one more question, how can I get the length of a string? Please reply me for these queries.

            S/W Engineer Akebono Soft Technologies aleem_abdul@akebonosoft.com.

            M Offline
            M Offline
            m rastgar
            wrote on last edited by
            #5

            1-.net id generator usually change your components id when it is rendering your component to client. it concats some prefix to the component original id. it is usually "ctl00_ContentPlaceHolder1_". so your component id in client mode will be converted to "ctl00_ContentPlaceHolder1_tbCmpName". so your code should be this: alter(document.getElementById('ctl00_ContentPlaceHolder1_tbCmpName').id); 2-string variable and its length: var b = 'Hello World'; window.alert(b.length); Thanks Rastgar

            1 Reply Last reply
            0
            • _ _AK_

              indian143 wrote:

              I want to access a Server control in .net within a Javascript function. I used this method. alert(alter(document.getElementById('tbCmpName').id); still its not working.

              Like this you can access server control in javascript: document.getElementById('tbCmpName')

              indian143 wrote:

              2. How can I declare string variables in Javascript? 3. And one more question, how can I get the length of a string?

              This[^] with help you in that regard.

              Best Regards, Apurva Kaushal

              I Offline
              I Offline
              indian143
              wrote on last edited by
              #6

              How can I add elements in to a .Net Drop down list server control using Javascript function. Like I have 3 dropdown list server controls. I want change the date field whenever month or year changed. If possible please give some code snippet.

              S/W Engineer Akebono Soft Technologies aleem_abdul@akebonosoft.com.

              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