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. Reference to form ???

Reference to form ???

Scheduled Pinned Locked Moved ASP.NET
questionsysadmintutorial
4 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.
  • M Offline
    M Offline
    MrMicrosoftvn
    wrote on last edited by
    #1

    Hello, In my CodeBehind, how can i get reference to the form tag with attritute runat="server" ???. For example, in my aspx file, i have a form below:

    the question is that how can i get reference to this form to set the attritute action="onepage.aspx" at run time ? I cant do that before. Thanks for yr replying.

    T 1 Reply Last reply
    0
    • M MrMicrosoftvn

      Hello, In my CodeBehind, how can i get reference to the form tag with attritute runat="server" ???. For example, in my aspx file, i have a form below:

      the question is that how can i get reference to this form to set the attritute action="onepage.aspx" at run time ? I cant do that before. Thanks for yr replying.

      T Offline
      T Offline
      Thea Burger
      wrote on last edited by
      #2

      You use the HTMLForm class to get access to the

      element. But you can't set the action property from code-behind. You can use either Response.Redirect or Server.Transfer. HTH, -Thea-

      M 1 Reply Last reply
      0
      • T Thea Burger

        You use the HTMLForm class to get access to the

        element. But you can't set the action property from code-behind. You can use either Response.Redirect or Server.Transfer. HTH, -Thea-

        M Offline
        M Offline
        Michael Flanakin
        wrote on last edited by
        #3

        I'd suggest the Server.Transfer, but it all depends on what you need. Server.Transfer sends the request directly to the targetted page, instead of going back to the user and then to the next page. Michael Flanakin Web Log

        M 1 Reply Last reply
        0
        • M Michael Flanakin

          I'd suggest the Server.Transfer, but it all depends on what you need. Server.Transfer sends the request directly to the targetted page, instead of going back to the user and then to the next page. Michael Flanakin Web Log

          M Offline
          M Offline
          MrMicrosoftvn
          wrote on last edited by
          #4

          thanks for your answer. My friend give me the way to resolve that. By using Javascript, we can rewrite the action value of the form as below: function RewriteAction() { document.Form1.action = "onepage.aspx"; } and when the click event of the button (OnClick event) occur, the function will be called and it will do rewrite the action value.

          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