|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Hi,
I'm in the process of rewriting a web form that contains a callback panel. In the legacy version of the web form the callback's triggers were tied to asp:buttons located in the form. To simplify the page I moved the input form containing the buttons into a custom user control and added that control to the page inside the callback panel. How can I reference the buttons in the user control in the callback panel's triggers?
Thanks, CN
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You will not be able to. The Trigger and the CallbackPanel must be in the same coding unit (Page, UserControl, etc). So in this case you can use the UserControl as a trigger, but will not be able to use a Button inside the UserControl as a trigger.
There are two work arounds for this scenario: 1. You can always trigger the CallbackPanel from anywhere with JavaScript. But that may require even more code changes; 2. You can place a second CallbackPanel inside your UserControl, then set the button to trigger that second CallbackPanel, and also set both CallbackPanel's GroupName to the same value. That way the button will trigger the second CallbackPanel, which also causes the first CallbackPanel to update;
Hope this helps.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Thanks.
Would be a possible to raise an event in my user control that triggers the callback panel. i.e. When the button is clicked in my user control I raise an event for the user control.
Thanks, CN
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
I do not think that will work if you are talking about server side event. The CallbackPanel must be triggered on the client side, so if you are already on the server side, it's already too late. The bottom line is the CallbackPanel provides you two ways to trigger it: through a trigger control or through JavaScript. Whatever else you may want to use, you will need to code to reach either of those two starting point first.
|
|
Rank: Advanced Member Groups: Member
Joined: 8/31/2008 Posts: 33
|
Thanks, I understand now. I'll investigate the java script option.
- CN
|
|