In the displayed dialog box RadWindow, confirm the deletion information.
To delete a message, a dialog box is displayed before deletion to check whether the information is deleted.
Click OK to delete the information. Click Cancel to close the dialog box without deleting the information.
1. On the Xaml page, delete the code of the control button.
1 <telerik: RadButton BorderThickness = "1" x: Name = "But_Del" Click = "But_Del_Click"> 2 <Grid Height = "Auto"> 3 <Grid. columnDefinitions> 4 <ColumnDefinition Width = "Auto"/> 5 <ColumnDefinition Width = "Auto"/> 6 </Grid. columnDefinitions> 7 <Image Grid. row = "0" Stretch = "Uniform" Margin = "3" Source = "/DRGS; Component/Images/edit_remove.png"/> 8 <TextBlock Grid. column = "1" TextAlignment = "Center" Text = "delete control" FontSize = "12" verticalignment = "Center"/> 9 </Grid> 10 </telerik: RadButton>View Code
2. Background code
1 /// <summary> 2 // Delete the contrast (batch delete) 3 /// </summary> 4 private void But_Del_Click (object sender, RoutedEventArgs e) 5 {6 if (mdc_icd10List.Count () = 0) 7 {8 RadWindow. alert ("select the information to delete! "); 9 return; 10} 11 12 DialogParameters dp = new DialogParameters (); 13 dp. Header =" delete "; 14 dp. Content =" are you sure you want to delete this message? "; 15 dp. okButtonContent = "OK"; 16 dp. cancelButtonContent = "canceled"; 17 dp. closed + = new EventHandler <WindowClosedEventArgs> (OnConfirmClosed); 18 RadWindow. confirm (dp); 19 20} 21 /// <summary> 22 // Confirm deletion 23 /// </summary> 24 private void OnConfirmClosed (object sender, WindowClosedEventArgs e) 25 {26 if (e. dialogResult = true) 27 {28 InterFace. iniService (); 29 InterFace. service. deleteMdcIcdListControlCompleted + = Service_DeleteMdcIcdListControlCompleted; 30 InterFace. service. deleteMdcIcdListControlAsync (mdc_icd10List); 31} 32} 33 void Service_DeleteMdcIcdListControlCompleted (object sender, WcfService. deleteMdcIcdListControlCompletedEventArgs e) 34 {35 try36 {37 if (e. result> 0) 38 {39 RadWindow. alert ("deleted successfully! "); 40 GridDataBinding (); 41} 42} 43 catch (Exception) 44 {45 RadWindow. alert (e. error. message); 46} 47 finally {MyRadBusy. isBusy = false;} 48}Cs Code
3. Database Operations (taking PostgreSQL database as an example)
1 /// <summary> 2 /// batch delete 3 /// </summary> 4 [OperationContract (Name = "DeleteMdcIcdListControl")] 5 public int DeleteMdcIcdControl (List <mdc_icd10> mdc_icd10List) 6 {7 int I = 0; 8 foreach (var mdc_icd10 in mdc_icd10List) 9 {10 string sqlStr = string. format (@ "Delete from mdc_icd10 where id = {0}", mdc_icd10.Id); 11 I + = pgSqlService. executeSql (sqlStr); 12} 13 return I = mdc_icd10List.Count? 1: 0; 14}Pgsql Code
Record completed...