Pop-up dialog radwindow, confirm delete Information

Source: Internet
Author: User

To do a delete function, but before deleting the normal pop-up dialog box to confirm whether to delete information, to prevent accidental deletion of information.

Click the OK button to delete the message and click the Cancel button to close the dialog box without deleting it.

1.Xaml page, delete the control button code.

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=" A"Verticalalignment="Center"/>9</Grid>Ten</telerik:RadButton>
View Code

2. Background code

1         /// <summary>2         ///Delete a controlled relationship (can be deleted in bulk)3         /// </summary>4         Private voidBut_del_click (Objectsender, RoutedEventArgs e)5         {6             if(Mdc_icd10list.count () = =0)7             {8Radwindow.alert ("Please select the information you want to delete! ");9                 return;Ten             } One  ADialogparameters DP =Newdialogparameters (); -Dp. Header ="Delete"; -Dp. Content ="are you sure you want to delete this message? "; theDp. Okbuttoncontent ="Determine"; -Dp. Cancelbuttoncontent ="Cancel"; -Dp. Closed + =NewEventhandler<windowclosedeventargs>(onconfirmclosed); - Radwindow.confirm (DP); +  -         } +         /// <summary> A         ///Confirm Delete at         /// </summary> -         Private voidOnconfirmclosed (Objectsender, Windowclosedeventargs e) -         { -             if(E.dialogresult = =true) -             { - Interface.iniservice (); inInterFace.Service.DeleteMdcIcdListControlCompleted + =service_deletemdcicdlistcontrolcompleted; - InterFace.Service.DeleteMdcIcdListControlAsync (mdc_icd10list); to             } +         } -         voidService_deletemdcicdlistcontrolcompleted (Objectsender, Wcfservice.deletemdcicdlistcontrolcompletedeventargs e) the         { *             Try $             {Panax Notoginseng                 if(E.result >0) -                 { theRadwindow.alert ("Delete Success! "); + griddatabinding (); A                 } the             } +             Catch(Exception) -             { $ Radwindow.alert (e.error.message); $             } -             finally{myradbusy.isbusy =false; } -}
CS Code

3. Database operations (for example, PostgreSQL database)

1         /// <summary>2         ///Bulk Delete3         /// </summary>4[OperationContract (Name ="Deletemdcicdlistcontrol")]5          Public intDeletemdcicdcontrol (list<mdc_icd10>mdc_icd10list)6         {7             inti =0;8             foreach(varMdc_icd10inchmdc_icd10list)9             {Ten                 stringSqlstr =string. Format (@"Delete from Mdc_icd10 where id={0}", Mdc_icd10. ID); Onei + =Pgsqlservice.executesql (SQLSTR); A             } -             returni = = Mdc_icd10list.count?1:0; -}
Pgsql Code

Record Complete ...

Pop-up dialog radwindow, confirm delete Information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.