Remove an Activity from the Database
In server-side code behind you can delete an existing Activity from the database. This may be required when users direct your application to remove an Activity outside of the Edit Appointment dialog, or as part of maintenance to clean-up Activities that have exceeded an age threshold (i.e., 12 months.)
Add an ASP.NET Button to your web form named "RemoveButton1", and handle it’s Click event. In the event handler, RemoveButton1_Click, you will locate an Activity object to be deleted (you may be able to obtain this from input through a TextBox or other user selection criteria), and then call the RemoveActivity method on the data provider.
Imports Infragistics.WebUI.Shared
Imports Infragistics.WebUI.WebSchedule
...
Private Sub RemoveButton1_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles RemoveButton1.Click
'Find the Appointment object to be deleted.
Dim appt As Appointment = Me.FindAppointment()
'Delete the Appointment from the database.
Me.WebScheduleSqlClientDataProvider1.RemoveActivity(appt)
End Sub
using Infragistics.WebUI.Shared;
using Infragistics.WebUI.WebSchedule;
...
private void RemoveButton1_Click(object sender, EventArgs e)
{
// Find the Appointment object to be deleted.
Appointment appt = this.FindAppointment();
// Delete the Appointment from the database.
this.WebScheduleSqlClientDataProvider1.RemoveActivity(appt);
}
Note
|
Note:
Although this example shows the Microsoft SQL Server data provider being used, this works with any data provider derived from WebScheduleDbProvider including OLE DB.
|