By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 3,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.