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

[Solved] Delete Button on AdvancedForm

7 Answers 193 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Alex Occhipinti
Top achievements
Rank 1
Alex Occhipinti asked on 10 Aug 2009, 08:55 AM

  Yes, there is a thread about how to do this, but it uses the older style for separate insert and edit forms.  My specific problem is that when mirroring the code the Javascript refuses to fire when the object is a LinkButton (a href), but has no problem when it is a regular Button.  Does this make any sense?

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 Aug 2009, 03:11 PM
Hi Alex,

Which thread have you seen? Here is a recent one:
http://www.telerik.com/community/forums/aspnet-ajax/scheduler/delete-appointment.aspx#903530

Is this what you need?

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Alex Occhipinti
Top achievements
Rank 1
answered on 10 Aug 2009, 03:57 PM
Actually it was this one:

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/adding-delete-button-to-advancededitform.aspx

  However, the link you posted is using a Button, which works fine, but looks terrible with the skinning done in the Advanced form to the save and cancel LinkButtons (background image and padding/magrins).

Markup from my AdvanceForm.ascx

                <asp:LinkButton runat="server" ID="UpdateButton" CssClass="rsAdvEditSave"
                    <span><%= Owner.Localization.Save %></span
                </asp:LinkButton> 
                <asp:Button runat="server" ID="ButtonDelete" OnClientClick="DeleteAppointment(); return false; " CausesValidation="false" Text="Remove" /> 
                <asp:LinkButton runat="server" ID="lnkDelete" CssClass="rsAdvEditCancel"  OnClientClick="DeleteAppointment(); return false;" 
                    CausesValidation="false"
                    <span>Delete</span> 
                </asp:LinkButton> 
                <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel" 
                    CausesValidation="false"
                    <span><%= Owner.Localization.Cancel %></span
                </asp:LinkButton> 
 

  The ButtonDelete works great, but looks like crap.  The LinkButton, lnkDelete, does a post back without executing the JavaScript, so looks right, but doesn't work.



0
Veselin Vasilev
Telerik team
answered on 13 Aug 2009, 09:07 AM
Hello Alex Occhipinti,

Please open the AdvancedForm.js file and go to line 63 or just find the line with the following content:

$("div.rsAdvancedSubmitArea a"this._formElement).attr("onclick"""); 

Just comment or simply delete that line and the link button should start executing its client click event.

All the best,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Alex Occhipinti
Top achievements
Rank 1
answered on 15 Aug 2009, 12:52 AM
  Like butter.  Thanks as always!
0
Alex Occhipinti
Top achievements
Rank 1
answered on 15 Aug 2009, 02:41 AM

  Ok, now that I've digested this a bit more, I'd like to followup my question with a little more detail.  The JavaScript that I had been using is the following:

                    <script type="text/javascript"
                        function DeleteAppointment() { 
                            var scheduler = $find("<%= Owner.ClientID %>"); 
                            var app = scheduler.get_currentAppointment(); 
 
                            if (confirm("Are you sure you want to delete this appointment?")) { 
                                scheduler.deleteAppointment(app, false); 
                                scheduler.hideAdvancedForm(); 
                            } 
 
                            return false
                        } 
                    </script> 
 

  The problem here, I now realize, is that the deleteAppoinment() function's second parameter determines, in the case of a recurring event, if the delete should be for a whole series or singular occurrence.  This is fine and dandy, but this code obviously does not ask the user...which is needs to. 

  Therefore, my question is...is there a way to modify this so that is gives the typical delete confirmation dialog?  Thanks.


0
Accepted
Veselin Vasilev
Telerik team
answered on 20 Aug 2009, 11:48 AM
Hello Alex Occhipinti,

You are right.

You can use this line to delete the appointment depending on the recurrence state of it:

scheduler.deleteAppointment(app, app.get_recurrenceState() > 0); 
 
I hope this helps.

Best wishes,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Alex Occhipinti
Top achievements
Rank 1
answered on 22 Aug 2009, 02:18 AM
Great!  Thank you!
Tags
Scheduler
Asked by
Alex Occhipinti
Top achievements
Rank 1
Answers by
Peter
Telerik team
Alex Occhipinti
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or