|
Rank: Member Groups: Member
Joined: 2/27/2008 Posts: 17
|
I am using the following Callback.
<eo:CallbackPanel id="cbStartDate" runat="server" GroupName="Main" Triggers="{ControlID:dgSick;Parameter:}">
The datagrid has a delete button with a javascript confirm in it.
Even when cancel is clicked on the javascript the delete fires anyways. This only occurs when callback is used.
Any ideas how to get the confirm delete to work properly?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, You will want to handle the callback's ClientSideBeforeExecute event. See a working example here: http://www.essentialobjects.com/Demo/Default.aspx?path=Callback\_i0\_i4The full source code of the sample project is available on your local machine after you install our controls. Thanks
|
|
Rank: Member Groups: Member
Joined: 2/27/2008 Posts: 17
|
Yah I found that and tried it out. The problem I am having is I am using a 2 callbacks grouped.
<eo:CallbackPanel id="cbStartDate" runat="server" GroupName="Main" Triggers="{ControlID:ddlType;Parameter:3},{ControlID:ddlType;Parameter:4},{ControlID:dgVacation;Parameter:},{ControlID:dgSick;Parameter:}">
AND
<eo:CallbackPanel id="cbSick" runat="server" GroupName="Main" width="100%" ClientSideBeforeExecute="confirm_delete">
The clientsidebeforeexecute only works when I add it to the top callback but I do not want it to fire there as thats not the datagrid. and when its added like the above it does not fire.
Any ideas?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi Mike,
ClientSideBeforeExecute is only fired on the CallbackPanel that triggers the callback, other CallbackPanels in the group are "riders", they do not participant any decision making. In your case, since dgSick is set as a trigger on the top CallbackPanel, it will only trigger ClientSideBeforeExecute on the top CallbackPanel. So if you wish it to be fired on the bottom CallbackPanel, you would need to move the trigger down.
Thanks
|
|
Rank: Member Groups: Member
Joined: 2/27/2008 Posts: 17
|
The triggers can only be set on one callback of the group correct?
|
|
Rank: Member Groups: Member
Joined: 2/27/2008 Posts: 17
|
Heres what I am trying to accomplish :)
CallbackOne - DropdownList - 2 Calendar Controls
CallbackTwo - DatagridOne with ClientSide Delete Button
CallbackThree - DatagridTwo with ClientSide Delete Button
When the Dropdown changes CallbackOne needs to fire.
When DatagridOne Delete or DatagridTwo Delete are selected CallbackOne, CallbackTwo and CallbackThree must fire. And the clientside javascript must fire on the two Datagrids.
Any ideas?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
You should: 1. Put DatagridOne as CallbackTwo's trigger, DataGridTwo as CallbackThree's trigger; 2. Set both CallbackTwo and CallbackThree's ClientSideBeforeExecute. You can use the same JavaScript function or different JavaScript function; 3. Group all three CallbackPanels together;
The basic idea is to get each CallbackPanel working independently first and then group them together. Forget about grouping when you try to trigger or cancel the callback because grouping has nothing to do with that. As previous mentioned, other CallbackPanels in the group are riders. They do not decide whether the callback gets triggered or not.
And yes. One control can only be set as one CallbackPanel's trigger.
Hope this clears up.
Thanks
|
|
Rank: Member Groups: Member
Joined: 2/27/2008 Posts: 17
|
Ok here is what I did.
CallbackOne - DropdownList <eo:CallbackPanel id="cbStartDate" runat="server" GroupName="Main" Triggers="{ControlID:ddlType;Parameter:3},{ControlID:ddlType;Parameter:4}">
CallbackTwo -DatagridOne <eo:CallbackPanel id="cbStat" runat="server" GroupName="Main" width="100%" Triggers="{ControlID:dgStat;Parameter:}" ClientSideBeforeExecute="Confirm_Delete">
CallbackThree -DatagridTwo <eo:CallbackPanel id="cbSick" runat="server" GroupName="Main" width="100%" Triggers="{ControlID:dgSick;Parameter:}" ClientSideBeforeExecute="Confirm_Delete">
Everything works great except the clientsidebeforeexecute fires twice...
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
We are not sure how that happens though. If you can isolate the problem into a test page (make sure it runs) and we will be happy to take a look.
Thanks
|
|
Rank: Member Groups: Member
Joined: 2/27/2008 Posts: 17
|
I got it to work. I had to remove
Delete.Attributes.Add("onclick", "return confirm_delete();");
from my ItemDatabound.
Thanks!
|
|