[Original] DataGrid Drag (with the header), do not refresh the page

xiaoxiao2021-03-05  28

#Region statement // --------------------------------------------- ------------------------- //// Modification: Li Wei (Nick.lee) //// DataGrid Drag (Table Head), do not refresh the page

// Time: 2005-04-17

// Boyorgril@msn.com// qq: 16503096 // Note: Please indicate the modified place, thank you // ------------------------- --------------------------------------------- # endregion front file < % @ Page language = "c #" codebehind = "Webform1.aspx.cs" autoeventwireup = "false" inherits = "WebApplication1.webform1"%> Webform1 </ title> <meta name =" generator "content =" Microsoft Visual Studio .NET 7.1> <meta name = "code_language" content = "c #"> <meta name = "vs_defaultClientScript" content = "JavaScript"> <meta name = "vs_targetSchema" content = "http://schemas.microsoft.com/intellisense/ie5"> </ HEAD> <body MS_POSITIONING = "GridLayout"> <form id = "Form1" method = "post" runat = "server"> <ask: DataGrid id = "DataGrid1" style = "z-index: 101; left: 16px; position: absolute; top: 16px" runat = "server" BorderColor = "# CC9966" BorderStyle = "None" BorderWidth = "1px" BackColor = "White" CellPadding = "4" Font-Size = "9pt"> <SelectedItemStyle Font-Bold = "True" ForeColor = "# 663399" BackColor = "# Ff CC66> </ selecteditemstyle> <itemStyle Forecolor = "# 330099" Backcolor = "White"> </ itemStyle> <headerstyle font-bold = "true" forcolor = "# fffcc" backcolor = "# 990000"> </ headerstyle > <</p> <p>FOOTERSTYLE Forecolor = "# 330099" Backcolor = "# fffcc"> </ footerStyle> <Pagersty Horizontalalign = "Center" forcolor = "# 330099" Backcolor = "# fffcc"> </ pageerstyle> </ asp: datagrid> </ Form> </ body> </ html> Background CS file</p> <p>using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls Using system.Web.ui.htmlcontrols;</p> <p>A summary description of Namespace WebApplication1 {/// <summary> /// WebForm1. /// </ summary> public class WebForm1: System.Web.UI.Page {internal System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; protected System.Data.SqlClient.SqlCommand sqlSelectCommand1; protected System.Data.SqlClient.SqlConnection sqlConnection1; protected WebApplication1.DataSet1 dataSet11; // protected GorthControls.GridSlideHeader GridSlideHeader1; // protected GorthControls.GridSlideHeader GridSlideHeader2; protected System.Web.UI.WebControls.DataGrid DataGrid1; private void Page_Load (object sender, System.EventArgs e) {// this Place the user code to initialize the page sqldataadapter1.fill (this.DataSet11); this.dataGrid1.datasource = this.dataSet11.tables [0]; this.database.database.DataBind (); this.dataGrid1.attributes.add ("OnSelectStart", " Return false "); this.dataGrid1.attributes.add (" onMouseDown "," f_mdown (this) "); this.dataGrid1.attributes.add (" onmousemove "," f_move (this) ");}</p> <p>#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // InitializeComponent (); base.onit (e);} /// <summary> /// Designer Supports the required method - Do not use the code editor to modify the // / this method.</p> <p>/// </ summary> private void InitializeComponent () {this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter (); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand (); this.sqlConnection1 = new System. Data.SqlClient.SqlConnection (); this.dataSet11 = new WebApplication1.DataSet1 ();. ((System.ComponentModel.ISupportInitialize) (this.dataSet11)) BeginInit (); // // sqlDataAdapter1 // this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange (new System.Data.Common.DataTableMapping [] {new System.Data.Common.DataTableMapping ( "Table", "Categories", new System.Data.Common.DataColumnMapping [ ] {New system.data.common.datacolumnMapping ("categoryid", "categoryid"), new system.data.common.datacolumnmapping ("categoryName", "categoryName", new System.Data.Common.DataColumnMapping ( "Description", "Description"), new System.Data.Common.DataColumnMapping ( "Picture", "Picture")})}); // // sqlSelectCommand1 // this.sqlSelectCommand1 .CommandText = "SELECT TOP 1 CategoryID, CategoryName, Description, Picture FROM Categories"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlConnection1 // this.sqlConnection1.ConnectionString = "workstation id = /" STAR-NICK / "; packet size = 4096; user ID = sa; data source = /" (local) / "; pers" </p> <p>"iSt security info = false; initial catalog = northwind; pwd = sa;"; // // dataset11 // this.dataset11.datasetName = "dataset1"; this.dataset11.locale = new system.globalization.cultureInfo ("zh -Cn "); this.Load = new system.EventHandler (this.page_load); (this.DataSet11)). Endinit ();} #ENDREGON}}</p> <p>Scripted file: / ** * <p> Title: DataGrid Drag (with the header, do not refresh page) </ p> * <p> description: implement DataGrid Drag on the page (with the header, do not refresh the page </ p> * <p> Copyright: 2005-2005 by mail_ricklee corporation </ p> * <p> company: mail_ricklee corporation </ p> * <p> CreateTime: 2005-04-17 21:30 </ P > * <P> modifytime: </ p> * @createauthor Li Wei * @version 1.0 * @ModifyAuthor * @version 1.0 * / <script language = "javascript"> <! - var currentmoveobj = null; // Current drag Dynamic object var rellex; // mouse Press position relative object position var RelTop; function f_mdown (obj) {currentmoveobj = obj; // Record the object currentmoveobj.Style.Position = "absolute"; rellex = event.x - currentMoveObj.style.pixelLeft; relTop = event.y - currentMoveObj.style.pixelTop;} window.document.onmouseup = function () {currentMoveObj = null; // if dragging the object while releasing the mouse button is released when} Function f_move (obj) {if (currentmoveobj! = null) {currentmoveobj.style.pixelleft = event.x-rellex; currentmoveobj.Style.pixeltop = event.y-reeltop;}}</p> <p>// -> </ script></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-33854.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="33854" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.036</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'dHqldIy_2B4rPh3oVWLi5dC_2BcXqaP3r_2B5f15FIDtaWP_2FRzyGXZP7FSEXhaLTV6FDjcYd2G9UZf0HbKf4tPpzweXQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>