473,395 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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__SelectedIndexChanged in User control1:
sends a 'Report Changed' event to main page.
4) MainPage_ReportChanged : Loads_Report User control
sends a 'Create Report' event to newly loaded control and saves report name in view state.
5) Report_UserControl_Load
6) Report_UserControl: 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:< ReportUserControl_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)

ReportUserControl_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 7523
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__SelectedIndexChanged in User control1:
sends a 'Report Changed' event to main page.
4) MainPage_ReportChanged : Loads_Report User control
sends a 'Create Report' event to newly loaded control and saves report name in view state.
5) Report_UserControl_Load
6) Report_UserControl: 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:< ReportUserControl_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)

ReportUserControl_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
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...
4
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,...
1
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...
5
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...
3
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...
5
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...
7
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...
4
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
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...

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.