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. when i disable controls in the form on client side they get disabled but ..

when i disable controls in the form on client side they get disabled but ..

Scheduled Pinned Locked Moved ASP.NET
csharptutorialjavascriptasp-netsysadmin
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.
  • Y Offline
    Y Offline
    yogita charhate
    wrote on last edited by
    #1

    I'm using asp.net and c#. I have disabled the controls on the form using javascript on onclientclick of the Button. But they again are activated when postback occurs when I return "true" because of the same buttonclick. When I return "false" then only disabled controls are maintained. But I also want to run the code at codebehind on button click of the same button to disaplay a popup on some condition. but don't want other controls on the page to be activated.till that poup is not closed. so how to achieve disabling of the other controls on client side and displaying popup on server side. Please guide. Thank you.

    yog hui gfgh kgdgrt njjn hjgkn

    C 1 Reply Last reply
    0
    • Y yogita charhate

      I'm using asp.net and c#. I have disabled the controls on the form using javascript on onclientclick of the Button. But they again are activated when postback occurs when I return "true" because of the same buttonclick. When I return "false" then only disabled controls are maintained. But I also want to run the code at codebehind on button click of the same button to disaplay a popup on some condition. but don't want other controls on the page to be activated.till that poup is not closed. so how to achieve disabling of the other controls on client side and displaying popup on server side. Please guide. Thank you.

      yog hui gfgh kgdgrt njjn hjgkn

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

      I don't really follow this ( how can you have a popup on the client side ), but you can use hidden controls to store values that change on the client side, and retrieve them on the server side to work out what HTML/script to render ( so after postback the control state does not change ).

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      Y 1 Reply Last reply
      0
      • C Christian Graus

        I don't really follow this ( how can you have a popup on the client side ), but you can use hidden controls to store values that change on the client side, and retrieve them on the server side to work out what HTML/script to render ( so after postback the control state does not change ).

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        Y Offline
        Y Offline
        yogita charhate
        wrote on last edited by
        #3

        Thank you for reply I don't want to display Popup using javascript but using c#. It means the code to display popup I'm using will run on server side not on client side. For this I want postback to be happened on button click event. This is possible if I use "return true;" in my javascript. But when there is postback all the disabled (that I made using javascript on clientclick event of the same button ) controls become enabled. So how to maintain the state of disability of controls even after postback of the page. This the problem for me . Might be clear to you now. Please suggest solution. Thank you.

        yog hui gfgh kgdgrt njjn hjgkn

        G 1 Reply Last reply
        0
        • Y yogita charhate

          Thank you for reply I don't want to display Popup using javascript but using c#. It means the code to display popup I'm using will run on server side not on client side. For this I want postback to be happened on button click event. This is possible if I use "return true;" in my javascript. But when there is postback all the disabled (that I made using javascript on clientclick event of the same button ) controls become enabled. So how to maintain the state of disability of controls even after postback of the page. This the problem for me . Might be clear to you now. Please suggest solution. Thank you.

          yog hui gfgh kgdgrt njjn hjgkn

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          yogita charhate wrote:

          I don't want to display Popup using javascript but using c#. It means the code to display popup I'm using will run on server side not on client side.

          You can't do that. A popup has to be opened on the client side.

          yogita charhate wrote:

          But when there is postback all the disabled (that I made using javascript on clientclick event of the same button ) controls become enabled.

          That's because a new page is loaded. The controls that you did disable doesn't exist any more. If you want any controls in the new page to be disabled, you have to disable them.

          --- single minded; short sighted; long gone;

          Y 1 Reply Last reply
          0
          • G Guffa

            yogita charhate wrote:

            I don't want to display Popup using javascript but using c#. It means the code to display popup I'm using will run on server side not on client side.

            You can't do that. A popup has to be opened on the client side.

            yogita charhate wrote:

            But when there is postback all the disabled (that I made using javascript on clientclick event of the same button ) controls become enabled.

            That's because a new page is loaded. The controls that you did disable doesn't exist any more. If you want any controls in the new page to be disabled, you have to disable them.

            --- single minded; short sighted; long gone;

            Y Offline
            Y Offline
            yogita charhate
            wrote on last edited by
            #5

            thank you Guffa for reply. My problem is solved by calling the function (to disable controls) on pageload . But before calling that function I checked one flag's value which is set on server side when buttonclick event occure and some conditionds are fulfilled. have a nice day!! :)

            yog hui gfgh kgdgrt njjn hjgkn

            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