473,703 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Events not firing (First time only) in a dynamic user control. Please help.

I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle.

1) MainPage_load
2) User control1_Load

user clicks a dropdown in UC1
_______________ __________

1) MainPage_Load
2) User Control_1 Load
3) dropdown__Selec tedIndexChanged in User control1:
sends a 'Report Changed' event to main page.
4) MainPage_Report Changed : Loads_Report User control
sends a 'Create Report' event to newly loaded control and saves report name in view state.
5) Report_UserCont rol_Load
6) Report_UserCont rol: Create Report (Populates a datagrid etc.)

Userclicks a button control on Report User control:
_______________ _______________ _______
1) Main Page_Load
2) User Control_1 Load
3) Report User Control Load ( Main page dynamically loads this control by looking at the report name saved in view state)

PROBLEM:< ReportUserContr ol_Button control event does NOT get fired >

User clicks on button control on Report User Control:
_______________ _______________ _____________
1) Main Page_Load
2) User Control_1 Load
3) Report User Control Load ( Main page dynamically loads this control by looking at the report name saved in view state)

ReportUserContr ol_Button control event gets fired
----- Shourie wrote: -----

Hi all,

I'm creating a reporting application, which is primarily a webpage with two user controls. One user control has a drop down with report names and other selection criteria controls needed for the report.
whenever the selection changes in the Report dropdown in the first user control, it sends a custom event to to the main page with the report name,selection criteria as eventargs.
The main page in turn loads the appropriate usercontrol for that report and sends another custom event to that usercontrol to create a report which typically has a datagrid.

So far so good,but when I click on a commandbutton in the datagrid, the ItemCommand fire does not fire for the first time but starts working from the second click.

I can see that binding the datagrid after the 'Report User controls Page_Load' (by way of handling an event from main page ) may be causing the event to not fire. However my requirement is also that I dynamically load the report control first and load its data. Greatly appreciate if any of you can show some direction on how I might be able to solve this design issue.

Thanks,
-Shourie
----- Shourie wrote: -----

Hi all,

I'm creating a reporting application, which is primarily a webpage with two user controls. One user control has a drop down with report names and other selection criteria controls needed for the report.
whenever the selection changes in the Report dropdown in the first user control, it sends a custom event to to the main page with the report name,selection criteria as eventargs.
The main page in turn loads the appropriate usercontrol for that report and sends another custom event to that usercontrol to create a report which typically has a datagrid.

So far so good,but when I click on a commandbutton in the datagrid, the ItemCommand fire does not fire for the first time but starts working from the second click.

I can see that binding the datagrid after the 'Report User controls Page_Load' (by way of handling an event from main page ) may be causing the event to not fire. However my requirement is also that I dynamically load the report control first and load its data. Greatly appreciate if any of you can show some direction on how I might be able to solve this design issue.

Nov 18 '05 #1
1 7582
I found the solution. I need to just set the IDs of the dynamically user controls for the events to fire.
Strange.(I'm even loading the usercontrol in the same function ).
Can any one throw light on why the ID is needed for the dynamic user control ?

Regards,
Shourie

----- Shourie wrote: -----

I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle.

1) MainPage_load
2) User control1_Load

user clicks a dropdown in UC1
_______________ __________

1) MainPage_Load
2) User Control_1 Load
3) dropdown__Selec tedIndexChanged in User control1:
sends a 'Report Changed' event to main page.
4) MainPage_Report Changed : Loads_Report User control
sends a 'Create Report' event to newly loaded control and saves report name in view state.
5) Report_UserCont rol_Load
6) Report_UserCont rol: Create Report (Populates a datagrid etc.)

Userclicks a button control on Report User control:
_______________ _______________ _______
1) Main Page_Load
2) User Control_1 Load
3) Report User Control Load ( Main page dynamically loads this control by looking at the report name saved in view state)

PROBLEM:< ReportUserContr ol_Button control event does NOT get fired >

User clicks on button control on Report User Control:
_______________ _______________ _____________
1) Main Page_Load
2) User Control_1 Load
3) Report User Control Load ( Main page dynamically loads this control by looking at the report name saved in view state)

ReportUserContr ol_Button control event gets fired
----- Shourie wrote: -----

Hi all,

I'm creating a reporting application, which is primarily a webpage with two user controls. One user control has a drop down with report names and other selection criteria controls needed for the report.
whenever the selection changes in the Report dropdown in the first user control, it sends a custom event to to the main page with the report name,selection criteria as eventargs.
The main page in turn loads the appropriate usercontrol for that report and sends another custom event to that usercontrol to create a report which typically has a datagrid.

So far so good,but when I click on a commandbutton in the datagrid, the ItemCommand fire does not fire for the first time but starts working from the second click.

I can see that binding the datagrid after the 'Report User controls Page_Load' (by way of handling an event from main page ) may be causing the event to not fire. However my requirement is also that I dynamically load the report control first and load its data. Greatly appreciate if any of you can show some direction on how I might be able to solve this design issue.

Thanks,
-Shourie
----- Shourie wrote: -----

Hi all,

I'm creating a reporting application, which is primarily a webpage with two user controls. One user control has a drop down with report names and other selection criteria controls needed for the report.
whenever the selection changes in the Report dropdown in the first user control, it sends a custom event to to the main page with the report name,selection criteria as eventargs.
The main page in turn loads the appropriate usercontrol for that report and sends another custom event to that usercontrol to create a report which typically has a datagrid.

So far so good,but when I click on a commandbutton in the datagrid, the ItemCommand fire does not fire for the first time but starts working from the second click.

I can see that binding the datagrid after the 'Report User controls Page_Load' (by way of handling an event from main page ) may be causing the event to not fire. However my requirement is also that I dynamically load the report control first and load its data. Greatly appreciate if any of you can show some direction on how I might be able to solve this design issue.

Nov 18 '05 #2

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

Similar topics

6
4475
by: Mark | last post by:
I have been working for quite some time on this issue which in theory should be quite simple. The problem is that the Cancel and Save events are not fired when their respective buttons are clicked. I have read several posts which say to put your column generating section in the Page_Init section and it will solve the problem....however, it hasn't solved mine. Can somebody please take a look at this and provide any insight if possible?
4
10117
by: Andy | last post by:
Alright, I am beyond confused here and need some guidance. I need a C# only sample. I have a simple Page and within it i am creating a user control (ascx). The user control contains textboxes, buttons, ect. I would like to catch/add a handler/recieve the Button.OnClick event from the buttons that are in the user control, in the Page. How? As far as I can tell, my only route is to: RaiseBubbleEvent in the Button.OnClick in the...
1
8161
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the first time the control is dynamically loaded, everything works fine. After that, if the control is loaded again from the page button event handler, the user controls events fail to fire on the first click NOTE: I (believe I) am rebuilding all...
5
11794
by: Ben Fidge | last post by:
I've got a problem where some buttons placed on a user control are only firing their OnClick events when the user clicks on them for the second time. I've got the situation where some common functionality (Insert/Edit/Save/Cancel) is wrapped up in a user control. This control is embedded on several other user controls. I don't know if this is relevant or not but the latter
3
2297
by: Mike | last post by:
Hi, I am adding controls dynamically in a WebForm, but none of these controls' events fire. Here is the class code I am using. I have tried so many things, but nothing works :-( namespace WebApplication1 { using System;
5
1768
by: Paal Berggreen | last post by:
I am involved with development of a Portal solution using ASP.NET 2.0 and WebParts. The WebParts framework use the default personalization providers, and the personalization data thus ends up in the aspnetdb database (which we have placed on a proper SQL Server, not SQL Server Express). Everything works like a charm, with the following exception: New users in the system have to press links or buttons twice upon their first logon to...
7
3110
by: AndrewMBaldwin | last post by:
I have a grid control (inherits from Placeholder) that has a few buttons on it. On this grid there is a filter form, which allows the user to filter/search the table for specific information. My problem is, that the order in which the event gets called. What is basically happening is that the control is instantiated, I call my initialize method, then I wait for the user to call GenerateGrid, in case they wanted to make any last minute...
4
4195
by: TS | last post by:
I am creating a User control and i create some dynamic controls in the init handler. one of the controls is a custom validator which i assign a serverValidate event handler. I usally always do my controls as custom server controls and don't understand why this event won't fire. I figured if the creation of the control was in the init, it would be initialized and have its event handlers set up, then after Load, the control would call its...
6
1749
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost datagrid's OnItemDataBound() method we check for the row in which it's appropriate to add the secondary datagrid. Exactly one row in the topmost grid will contain the secondary grid.
0
9257
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9123
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8969
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4434
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3125
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
2
2462
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2070
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.