Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
adding a button at run time
posted

I need to be able to add multiple buttons at run time.

Although adding the buttons is easy enough I can't find how to tell it what sub routine in the back end to run when it's clicked. You can change the command name and argument, and you can also set it to run a specific sub at the client side (MyButton.ClientSideEvents.Click = "MySub"), but I can't find anything to tell it which sub to run at the back end as I don't want it to be client side.

Any help appreciated!

Parents
No Data
Reply
  • 995
    posted

    In addition, if you want to run different subs based on which button has been clicked you can use CommandName as identifier and call different sub routines inside the button click event handler:

    void button_Click(object sender, ButtonEventArgs e)

        {

            WebImageButton button = (WebImageButton)sender;

            if(button.CommandName == "sub1")

                SubRoutine1();

            else

                SubRoutine2();

            return;

        }


    --------------------------------------------------------------------------------


    Sincerely,
    Batnasan
    Developer Support Engineer, MCAD
    Infragistics
    www.infragistics.com/support

Children
No Data