Events problem...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lupin3d

    #1

    Events problem...

    Hi...
    i have an aspx page(home.aspx) that contains an ascx usercontrol
    (chrt.ascx).
    In home.aspx there is a button with his event...
    In the ascx page i want to create an event for that button.... i do in
    this way...

    (home.aspx)
    private void InitializeCompo nent()
    {
    this.button1.cl ick += new System.EventHan dler(this.butto n1_Click);
    }

    public static event EventHandler butt_click;

    private void button1_Click(o bject sender, System.EventArg s e)
    {
    butt_click(this ,e);
    }

    (chrt.ascx)
    private void InitializeCompo nent()
    {
    home.butt_click += new System.EventHan dler(this.butt1 _click);
    }

    private void butt1_click(obj ect sender, System.EventArg s e)
    {
    ...... // code that calls a stored procedure
    }

    But....if i open Sql Profiler i see that when i click this button once
    the stored procedure is called once...if i click another time the
    stored procedure is called twice...and so on...after an intense use of
    the site (the button was clicked ten times) the site become very slow
    due the many calling to the stored procedure...

    can u help in my trouble?

    10nx a lot.


Working...