Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button Question
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
01451845
Message ID:
01451973
Views:
32
>I placed a button on a page in the Page_Load:
>
>
>Button cmdPrint = new Button();
>cmdPrint.Text = "Print";
>
>
>1) When I click it my app navigates to some new default page. I don't want this, I want it to fire the Click event only. How do I prevent
>it from navigating?
>
>
>2) The Click event for my button never fires. What gives?

There's not really enough code here to give you a good answer. If you're adding controls dynamically, you need to make sure the button is recreated on every hit. You also need to make sure you add them to the form's Control collection, ex. this.Controls.Add(cmdPrint). You will also need to programmatically hook up your click method on each hit, ex. cmdPrint += cmdPrint_Click;
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform