This is a migrated thread and some comments may be shown as answers.

Edit form user control does not receive other user control's evnets

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Safa Amini
Top achievements
Rank 1
Safa Amini asked on 07 May 2010, 08:27 PM
Hi,
I have a user control (ucParent) and inside it I have another user control (ucChild) which after some action fires an event (ChildActionEvent) which is in turn received by ucParent to update some textbox. When I put ucParent on a normal page, the events fire correctly:
ucChild.RaiseEvent (ChildActionEvent)  -->> ucParent receives event. 

But when ucParent is used as the edit template for my grid, the event is "lost" and not captured by ucParent in the grid row (which is obviously in the edit mode).

Is there anything I have missed?

Please help.
Thank you very much.

ps. I'll be more than happy to provide the sample code if I should.

1 Answer, 1 is accepted

Sort by
0
Safa Amini
Top achievements
Rank 1
answered on 09 May 2010, 01:21 PM
Hi again,
I resolved the problem already.
It was not because of the event chain (which was OK) but because of the following scenario:
The user control (ucParent) is used as the edit template in the grid and it calls a RadWindow and gets the return value through a small piece of javascript (as instructed by RadWindow tutorials) which is in the markup of ucParent.

The grid works normally and ucParent is updated by the return value, UNLESS you ajaxify the grid, in which case, apparently because there is no full postback, the javascript in the markup of ucParent does not appear in the page and the return value is lost in the air. There are two workarounds, and in both scenarios the script in question shows up in the page source in IE:
  1. "De-jaxify" the grid and allow a full postback, which is not desirable at all. 
  2. Add the script to the same page markup where the grid sits and handle the RadAjaxPanel1_AjaxRequest event to pass the value to the row which is being updated or inserted (using MasterTableView.GetInsertItem).
  3. Don't use the user control in the edit template and put it somewhere on the form. Again things are ok, ajax or no ajax.
I am using the second approach and is working fine.

Please let me know if there is anything further I should or could do.

Thanks a lot,
Safa
Tags
Grid
Asked by
Safa Amini
Top achievements
Rank 1
Answers by
Safa Amini
Top achievements
Rank 1
Share this question
or