asp.net use the Repeater control to drag and drop implementation sorting and Synchronize database field sorting _ Practical Tips

Source: Internet
Author: User

database table has a unit table, which includes the ID, Name, order, and other fields, there is a background management function, you can set these units in some statistical tables in the order of display, so think of the drag-and-drop method to achieve, so that the operation easier.

Using the Gifcam software to do a sample animation, the effect is as shown in the following illustration:

So I started, and found that Jquery.ui provides sortable functions, which can be used for sorting, the interface from the database-bound units using the Repeater control, the following is a brief introduction to the main steps:

1, the project use of Jquery-1.7.2.min.js and jquery-ui.min.js please click to download, Address: http://download.csdn.net/detail/taomanman/9315373

2, Testdemo.aspx code is as follows:

<! DOCTYPE html>  

The TestDemo.cs code is as follows, the concrete database operation class obtains the data according to the respective situation to carry on, does not have the detailed introduction here.

public partial class TestDemo:System.Web.UI.Page 
{public 
  static GGJ_DC_DATACENTERBASEINFOBLL BLL = new Ggj_dc_ DATACENTERBASEINFOBLL (); 
  protected void Page_Load (object sender, EventArgs e) 
  { 
    if (! IsPostBack) 
    { 
      binddata (); 
    } 
  } 
  <summary> 
  ///Binding Ministry Unit 
  ///</summary> public 
  void Binddata () 
  { 
    string where = " "; 
    String by = "F_order ASC"; 
    DataTable dt = BLL. GetData (where, by); 
    This.rpt.DataSource = DT; 
    This.rpt.DataBind (); 
  } 

3, the $.ajax method requests the page update.aspx and Update.aspx.cs code as follows:

<! DOCTYPE html>  

The above is a small part of the introduction of the asp.net in the use of repeater control to drag and drop the implementation of the sorting and synchronization of database fields, I hope you like.

Related Article

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.