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. Behaviour of HTML/ASP controls in Master page

Behaviour of HTML/ASP controls in Master page

Scheduled Pinned Locked Moved ASP.NET
htmldatabasetutorialquestion
5 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.
  • A Offline
    A Offline
    amittinku
    wrote on last edited by
    #1

    Sorry Chris, I might be asking similar type question earlier also but this is final summary. Suppose we have designed a master page. Say we keep nothing in it. We inherit it in a webform. Now I have observed the following. Please confirm,reply also: 1. <form> /<form> is not present. HTML Reset button works fine. Document.getelementbyid-> does not work because form is not present. 2. In web form where i have inherited master page, I keep one html reset button and standard asp text box. If autopostback of textbox=true then whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load). If autopostback of textbox=false then whatever we enter in textbox and click on reset, value will be cleared. 3. In my requirement i have inherited master page in web form as mentioned above. It's requirement to keep autopost back of textbox=True. Now reset will never clear the values of text box. In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified. function ResetForm(){    var elems = document.forms[0].elements;    for(var i=0;i<elems.length;i++){       elems[i].value = "";    } } So in webform (using master page), how to clear the values of text box on clicking of button. Note: document will not work because <form> is not present. autopost back will be true for text box because we have to trigger event TextBox1_TextChanged1 also. TextBox1_TextChanged1 will not work without autopostback. So plz tell me solution.

    C P 2 Replies Last reply
    0
    • A amittinku

      Sorry Chris, I might be asking similar type question earlier also but this is final summary. Suppose we have designed a master page. Say we keep nothing in it. We inherit it in a webform. Now I have observed the following. Please confirm,reply also: 1. <form> /<form> is not present. HTML Reset button works fine. Document.getelementbyid-> does not work because form is not present. 2. In web form where i have inherited master page, I keep one html reset button and standard asp text box. If autopostback of textbox=true then whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load). If autopostback of textbox=false then whatever we enter in textbox and click on reset, value will be cleared. 3. In my requirement i have inherited master page in web form as mentioned above. It's requirement to keep autopost back of textbox=True. Now reset will never clear the values of text box. In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified. function ResetForm(){    var elems = document.forms[0].elements;    for(var i=0;i<elems.length;i++){       elems[i].value = "";    } } So in webform (using master page), how to clear the values of text box on clicking of button. Note: document will not work because <form> is not present. autopost back will be true for text box because we have to trigger event TextBox1_TextChanged1 also. TextBox1_TextChanged1 will not work without autopostback. So plz tell me solution.

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

      amittinku wrote:

      <form> /<form> is not present.

      your page is broken if this is true

      amittinku wrote:

      If autopostback of textbox=true then whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load). If autopostback of textbox=false then whatever we enter in textbox and click on reset, value will be cleared.

      Because you don't have a form

      amittinku wrote:

      In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified.

      Correct

      amittinku wrote:

      So in webform (using master page), how to clear the values of text box on clicking of button.

      PUT A FORM ON THE PAGE !!!! And don't post a new question when your old one is still visible, and you're asking the same thing.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      A 1 Reply Last reply
      0
      • C Christian Graus

        amittinku wrote:

        <form> /<form> is not present.

        your page is broken if this is true

        amittinku wrote:

        If autopostback of textbox=true then whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load). If autopostback of textbox=false then whatever we enter in textbox and click on reset, value will be cleared.

        Because you don't have a form

        amittinku wrote:

        In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified.

        Correct

        amittinku wrote:

        So in webform (using master page), how to clear the values of text box on clicking of button.

        PUT A FORM ON THE PAGE !!!! And don't post a new question when your old one is still visible, and you're asking the same thing.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        A Offline
        A Offline
        amittinku
        wrote on last edited by
        #3

        PUT A FORM ON THE PAGE !!!! I have inherited master page. Now I will have to paste controls on Content. Can we still post a form, there is so speciic control as such

        C 1 Reply Last reply
        0
        • A amittinku

          PUT A FORM ON THE PAGE !!!! I have inherited master page. Now I will have to paste controls on Content. Can we still post a form, there is so speciic control as such

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

          Your master page defines the form, if it's written right. The content pages go inside the form. An ASP.NET page should only have one form on it.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          1 Reply Last reply
          0
          • A amittinku

            Sorry Chris, I might be asking similar type question earlier also but this is final summary. Suppose we have designed a master page. Say we keep nothing in it. We inherit it in a webform. Now I have observed the following. Please confirm,reply also: 1. <form> /<form> is not present. HTML Reset button works fine. Document.getelementbyid-> does not work because form is not present. 2. In web form where i have inherited master page, I keep one html reset button and standard asp text box. If autopostback of textbox=true then whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load). If autopostback of textbox=false then whatever we enter in textbox and click on reset, value will be cleared. 3. In my requirement i have inherited master page in web form as mentioned above. It's requirement to keep autopost back of textbox=True. Now reset will never clear the values of text box. In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified. function ResetForm(){    var elems = document.forms[0].elements;    for(var i=0;i<elems.length;i++){       elems[i].value = "";    } } So in webform (using master page), how to clear the values of text box on clicking of button. Note: document will not work because <form> is not present. autopost back will be true for text box because we have to trigger event TextBox1_TextChanged1 also. TextBox1_TextChanged1 will not work without autopostback. So plz tell me solution.

            P Offline
            P Offline
            Prabhakar Parihar
            wrote on last edited by
            #5

            In Asp .net set the Text Box property EnableViewState="false" then ur prob are solve.........

            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