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. check box click server side event not working once validation summary is displayed

check box click server side event not working once validation summary is displayed

Scheduled Pinned Locked Moved ASP.NET
javascriptsysadmintools
2 Posts 2 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.
  • F Offline
    F Offline
    For_IT
    wrote on last edited by
    #1

    Hi all I have a user control with textbox fields to enter the address. If the fields are empty, the validation summary will be displayed. There is one checkbox on the control to fill up the text boxes if it is checked in. When the validation summary is available on the page, and I click on the checkbox, to automatically fill the text boxes, it does not work. Server side event is not getting fired when I check and uncheck the checkbox for the first time when validation summary is available on page. I added, client side to event to CheckBox and then called __doPostBack event from the javascript. But postback is not happening. I have following javascript

    function OnCheckClick()
    {
    __doPostBack('SameAddressCheckBox','');

    }

    When I used the above script on "onclick" event of checkbox, after validation summary appears on page, when I try to check in the checkbox, validation summary goes away, but the checkbox is not getting checked in and server side event is also not called. can anyone please suggest some thing so that postback can happen and will call serverside event. Many thanks.

    H 1 Reply Last reply
    0
    • F For_IT

      Hi all I have a user control with textbox fields to enter the address. If the fields are empty, the validation summary will be displayed. There is one checkbox on the control to fill up the text boxes if it is checked in. When the validation summary is available on the page, and I click on the checkbox, to automatically fill the text boxes, it does not work. Server side event is not getting fired when I check and uncheck the checkbox for the first time when validation summary is available on page. I added, client side to event to CheckBox and then called __doPostBack event from the javascript. But postback is not happening. I have following javascript

      function OnCheckClick()
      {
      __doPostBack('SameAddressCheckBox','');

      }

      When I used the above script on "onclick" event of checkbox, after validation summary appears on page, when I try to check in the checkbox, validation summary goes away, but the checkbox is not getting checked in and server side event is also not called. can anyone please suggest some thing so that postback can happen and will call serverside event. Many thanks.

      H Offline
      H Offline
      Herman T Instance
      wrote on last edited by
      #2

      you do not need javascript in this case CheckBox has properties AutoPostBack and OnCheckChanged. in your ASPX something like <asp:CheckBox runat="server" ID="chkTest" AutoPostBack="true" OnCheckedChanged="chkTest_OnCheckedChanged" /> in your ASPX.cs something like protected void chkTest_OnCheckedChanged(Object sender, EventArgs e) { if (chkText.Checked) { // your code } else { // your code } } Good Luck

      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