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. Is it possible to kill all events for a control?

Is it possible to kill all events for a control?

Scheduled Pinned Locked Moved ASP.NET
helpquestion
1 Posts 1 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.
  • T Offline
    T Offline
    thomasa
    wrote on last edited by
    #1

    I have a page with a bunch og events for buttons and textchanged. At page load I want to validate an object I have added to Chash, an if it fails I want to kill the event that the user has triggerd, something like

    protected void Page_Load(object sender, EventArgs e)
    {
    if (MyChachItem == null)
    {
    // Kill the event so it is not triggerd
    MyAntemPlaceHolder.Visible = true;
    ShowMessage(MyAntemPlaceHolder, "Can not continue, please click on the list button and start over.")
    }
    }

    So the user clicks a button (btnSave) on the page, that triggers the btnSave_Click(..) event. Thus, by the time the MyChachItem is null, as validate at Page_Load, and within that if() I want to kill the btnSave_Click(..) event, so it isn't triggerd. I think it's possible to use somthing like:

    btnSave.Click -= btnSave_Click(..)

    But my problem is that the MyHugeWebControl.ascx contains a lot of controlers with different events, and I was wondering if there where something I could do to kill all the events within that control. Thanks Thomas

    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