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 in ASP.NET

Javascript in ASP.NET

Scheduled Pinned Locked Moved ASP.NET
csharpjavascripthtmlasp-nettutorial
4 Posts 4 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.
  • V Offline
    V Offline
    Vector7
    wrote on last edited by
    #1

    Currently, I am working on some tests with implementing Javascript into ASP.NET Pages. 1 )Is there a way that ASP.NET can access standard HTML Objects ( for example a hidden input field )`? 2) Is it possible to start a javascript in ASP.NET at different places ( not at start like the standard )

    D T M 3 Replies Last reply
    0
    • V Vector7

      Currently, I am working on some tests with implementing Javascript into ASP.NET Pages. 1 )Is there a way that ASP.NET can access standard HTML Objects ( for example a hidden input field )`? 2) Is it possible to start a javascript in ASP.NET at different places ( not at start like the standard )

      D Offline
      D Offline
      DavidNohejl
      wrote on last edited by
      #2

      Vector7 wrote: Is there a way that ASP.NET can access standard HTML Objects ( for example a hidden input field )`? hmm what do you mean? On server or on client? ASP.NET (or better System.Web.UI.HtmlControls namespace) provides classes - server side controls - to expose properties of HTML controls on server side. Basicaly add runat="server" to your HTML element and provide member variable of suitable "HtmlControl" class in your page class. If you want to acces HTML elements on client as you do with JS, you must use client script like JS or VBScript. Vector7 wrote: 2) Is it possible to start a javascript in ASP.NET at different places ( not at start like the standard ) Yes. What is standart, btw? Head tag? You can write your JS wherever you want - using standart ASP.NET functions ( as described in article) , attributes for Server controls (in article again), or you can even write JS code directly to page using inline script (<% %>) and Response object. (I don't know any reason for this right now, bt why not? :) ) Injecting Client-Side Script from an ASP.NET Server Control[^] hope it helps, best regards, David 'DNH' Nohejl Never forget: "Stay kul and happy" (I.A.)

      1 Reply Last reply
      0
      • V Vector7

        Currently, I am working on some tests with implementing Javascript into ASP.NET Pages. 1 )Is there a way that ASP.NET can access standard HTML Objects ( for example a hidden input field )`? 2) Is it possible to start a javascript in ASP.NET at different places ( not at start like the standard )

        T Offline
        T Offline
        tonaxxl
        wrote on last edited by
        #3

        put a normal html button and make onclick=ur javasript function as exampl an a logout html button 1.write this code at the aspx page function logout(){ if(window.confirm("Are you sure u want to logout")) {window.navigate("../login.aspx?tona='ok'"); } } 2.write this button in the aspx page some thing like that :)

        1 Reply Last reply
        0
        • V Vector7

          Currently, I am working on some tests with implementing Javascript into ASP.NET Pages. 1 )Is there a way that ASP.NET can access standard HTML Objects ( for example a hidden input field )`? 2) Is it possible to start a javascript in ASP.NET at different places ( not at start like the standard )

          M Offline
          M Offline
          Mattias Olgerfelt
          wrote on last edited by
          #4

          1. Asign the tag an id a nd specify the tag to be runat="server". eg: Note that the tag has to follow XHTML-syntax. Means it must be ended and it has to have quotes around the attribute-values. Then, in the pagebegind write something like this: protected System.Web.UI.HtmlControls.HtmlGenericControl styleLink; tada... now you can access the element from code behind. eg: styleLink.Attributes.Add("href", "../css/nice.css"); 2. Yes. How dow you mean?

          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