ExtJS and. NET development examples (bulk deletion of grid)

Source: Internet
Author: User
Tags bool

Connect ExtJS with. NET Development example (grid data display, paging, sorting the article), on this basis to achieve the bulk deletion function.

The following steps are implemented:

1. Implement the deletion function with WebService (the article has a garden friends to put forward to use WebService to realize, here by the way, take the data source can also use WebService, we can refer to the deletion of the webservice to achieve their own, I here is not tired of the statement)

Create a new WebService file named: Deleteproject.asmx

The code is as follows:

DeleteProject.asmx.cs

1using System;
2using System.Data;
3using System.Linq;
4using system.web;
5using System.Collections;
6using System.Web.Services;
7using System.Web.Services.Protocols;
8using System.ComponentModel;
9using System.Xml.Linq;
10using businessobject.projects; References to DBML files
11using Database;
12namespace Web.Projects.OperProjects
13{
/**////<summary>
///Summary description for Deleteproject
///</summary>
[WebService (Namespace = "http://tempuri.org/")]
[WebServiceBinding (ConformsTo = wsiprofiles.basicprofile1_1)]
[ToolboxItem (False)]
The//To allow this Web Service to is called from script, using ASP.net AJAX, uncomment the following line.
//[System.Web.Script.Services.ScriptService]
public class DeleteProject:System.Web.Services.WebService
23 {
24
[WebMethod]
Num public bool Delproject (string strprojects)//Here need to return the deletion succeeded to the ExtJS call
27 {
BOOL result = FALSE;
Try
30 {
Projectbaseinfodatacontext db = new Projectbaseinfodatacontext ();
The var projects = from P in db. Project_base_infos
where Strprojects.indexof (p.project_no) > 0
Select P;
Db. Project_base_infos.deleteallonsubmit (projects);
result = true;
37}
The catch {
result = false;
40}
41
return to result;
43}
44}
45}
46

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.