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

Discussion in 'ASP .Net' started by =?Utf-8?B?U2hvdXJpZQ==?=, Jan 21, 2004.

  1. 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.
    =?Utf-8?B?U2hvdXJpZQ==?=, Jan 21, 2004
    #1
    1. Advertising

  2. 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.
    =?Utf-8?B?U2hvdXJpZQ==?=, Jan 21, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob
    Replies:
    1
    Views:
    7,692
    nfedin
    Feb 10, 2004
  2. vatech1993
    Replies:
    4
    Views:
    5,675
    =?Utf-8?B?U8Opcmdpbw==?=
    Dec 11, 2004
  3. Don
    Replies:
    3
    Views:
    5,434
    Karl Seguin
    Mar 11, 2005
  4. KJ
    Replies:
    0
    Views:
    119
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    341
    Chris
    Aug 30, 2005
Loading...

Share This Page