473,545 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to capture dynamically a button click on a usercontrol, and in page?

Hi,

I've read about bubble events and setting up the event args and several
other methods to have an event that occurs in a usercontrol flow up to
the parent. The problem is each one entails a lot of coding for just
one use control. Well, I have many user controls and am looking for a
very simple and universial approach. The problem is: I have a webpage
test.aspx and on it I can load any user control I want based on what
the user selects from a menu. Once the usercontrol is up. I want to
say click Save, do my database updates with the click event. Then
after that I want to load in a new usercontrol from the Main webpage.
Considering the size the application will be when someone clicks a
button, or save, or anything I can load many different user controls.
So is there a simple approach that I could take to call my public
LoadNewUserCont rol(usercontrol file) method I have in the parent class?

I've seen people do something like this in the Button Click event
inside the user control, but it didn't work for me. The test class
doesn't exist or isn't a type that I can cast too.

Page aPage = (test) this.Parent;
aPage.LoadNewUs erControl(test5 .ascx);

Nor does this work:

this.Parent as test;

Anyways, Please a few recommendations on how to approach this.

Thanks,

David

Aug 30 '06 #1
0 1206

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2792
by: jw56578 | last post by:
Hi, How would the following be accomplished. I have a parent aspx page, that dynamically loads 3 user controls (through LoadControl) depending on a certain criteria. I want the click of a button on one user control to make another user control invisible. How can the parent aspx page capture that click event so that it can know to do...
6
3357
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all the usual stuff of recreating the usercontrol in the Page Init event. The 'failure' sequence is as follows: - select web form button to display...
1
7588
by: jelle.huygen | last post by:
Hello, I have a problem in ASP.NET 2.0 with the viewstate of my dynamically added user control. I have reproduced the problem with a very simple user control and a very simple page. On my usercontrol is a button and a label. Everytime the button is clicked a counter which is stored in the viewstate is increased and displayed in the...
2
11973
by: ami | last post by:
In my code, I need to implement x numbers of Gridviews dynamically based on user selection. Because I am unaware of the number of gridviews, this is done after the user enters input. I need to implement paging on these gridviews. I set paging to true and register the event handler. However, this event handler is never being fired (this...
0
7411
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7669
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7773
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5987
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4962
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3468
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.