Re: How to add an event handler at run time?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Niranjan (niranjan.marathe_at_ugs.com)
Date: 09/15/04


Date: Wed, 15 Sep 2004 15:45:52 +0530

Jeff,

I guess you are adding the handler for the click event in the
"Page_PreRender" as by this time all the controls are created ready to be
rendered. I hope this helps.

Regards,
Niranjan
"Jeff" <Jeff@discussions.microsoft.com> wrote in message
news:A1B4F401-C9D6-4AE6-80F5-ABED23692FED@microsoft.com...
> I have created an array of buttons at run time and need to associate them
a
> click event. I have added the following routine as the event:
>
> public void UpdateClick(Object sender, EventArgs e)
> {
> lblError.Visible=true;
> lblError.Text="It worked";
> }
>
> Below I have included the line of code used to hook up the button with the
> event:
>
> btnUpdate[intElement1].Click+=new System.EventHandler(UpdateClick);
>
> The code in the click routine does not run when the button is clicked. Can
> anyone tell me what I am missing? Thanks in advance.
>
> Regards,
> Jeff
>



Relevant Pages

  • Re: Need to create Eventhandler for control created at runtime
    ... At what point in the page lifecycle are you adding these controls? ... "Jeff" wrote in message ... >I have created an array of buttons at run time and need to associate them ... > The code in the click routine does not run when the button is clicked. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: How to add an event handler at run time?
    ... added to the page's control array. ... > The code in the click routine does not run when the button is clicked. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: with random Nos calc how can I stop two different columns pre
    ... > Many thyanks but you sugest writting my own routine, ... > thanking you in anticipation regards ... >> Randbetween does not generate unique random numbers. ... >> Tom Ogilvy ...
    (microsoft.public.excel.programming)
  • Re: check if file already is open
    ... Regards, ... "Tom Ogilvy" wrote: ... Macro Code to Check Whether a File Is Already Open ... >> interrupt the routine and give a msg "the file is already opened by ...
    (microsoft.public.excel.programming)
  • Re: Interactive Query to Reference user Defined Variables
    ... Hi Jeff, Thank you for taking the time to look at this. ... The Range A4:AX5 is the Criteria where row 4 contains the field names to ... Best Regards, ... Tim ...
    (microsoft.public.access.queries)