This article mainly introduces the ASP.net DataList binding data can be moved up and down after the sample code, the need for friends can refer to the following
Code as follows: if (E.commandname = "Up") { int index = e.item.itemindex; string TitleID = Rgzdgz.masterta bleview.datakeyvalues[index]["TitleID"]. ToString (). Trim (); if (E.item.itemindex > 0) { zdgztitles.zdgztitlesdisplaynum ( rgzdgz.mastertableview.datakeyvalues[index]["TitleID"]. ToString (). Trim (), rgzdgz.mastertableview.datakeyvalues[index-1]["TitleID"]. ToString (). Trim ()); Clear (); rgzdgz.rebind (); } else { ("The item is already on top and cannot be moved up. "); } } else if (e.commandname =" Down ") { int index = e.item.itemindex; string Title ID = rgzdgz.mastertableview.datakeyvalues[index]["TitleID"]. ToString (). Trim (); if (E.item.itemindex < rgzdgz.items.count-1) { Zdgztitles.zdgztitlesdisplaynum ( rgzdgz.mastertableview.datakeyvalues[index]["TitleID"]. ToString (). Trim (), rgzdgz.mastertableview.datakeyvalues[index+1]["TitleID"]. ToString (). Trim ()); CleAR (); rgzdgz.rebind (); } else { showmessage ("This item is already at the bottom and cannot be moved down again. "); }