[Original] DataGrid drags lines in the page (in the header, implemented with HTC file)

xiaoxiao2021-03-05  48

#Region statement // --------------------------------------------- ------------------------- /// / Modification: Li Wei (Nick.lee) /// // DataGrid dragged in the page (in Head, implementation with HTC files)

// Time: 2005-04-23

// Boyorgril@msn.com// Boyorgril@hotmail.com// qq: 16503096 // Note: Please indicate the modified place, thank you // ------------------ -------------------------------------------------- - # endRegion

Front page <% @ page language = "c #" codebehind = "Webform5.aspx.cs" autoeventwireup = "false" inherits = "WebApplication1.webform5"%> Webform5 </ 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"> <LINK href = "xpTable.css" type = " TEXT / CSS "REL =" Stylesheet "> </ head> <body> <form id =" form1 "method =" post "runat =" server "> <ask: dataGrid id =" datagrid1 "runat =" server "font -Size = "9pt" cellpadding = "4" style = "behavior: URL (grid.htc)" bordercolor = "# cc9966" borderwidth = "none" borderwidth = "1px" backcolor = "White> <selecteditemstyle font-bold = "True" ForeColor = "# 663399" BackColor = "# FFCC66"> </ SelectedItemStyle> <ItemStyle ForeColor = "# 330099" BackColor = "White"> </ ItemStyle> <HeaderStyle Font-Bold = "True" ForeColor = "# FFFCC "BackColor =" # 990000 "> </ headerstyle> <footerStyle Forecolor =" # 330099 "Backcolor =" # fffcc "> </ footerStyle> <PagersTyle horizontalalign ="</p> <p>Center "Forecolor =" # 330099 "Backcolor =" # fffcc "> </ pagersty> </ asp: dataGrid> </ form> </ body> </ html> background CS file Using system.collections; 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; namespace WebApplication1 {/// <summary> /// summary of WebForm5 /// </ summary> public class WebForm5: System.Web.UI.Page {protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; protected System.Data. .SqlClient.SqlCommand sqlSelectCommand1; protected System.Data.SqlClient.SqlConnection sqlConnection1; protected WebApplication1.DataSet1 dataSet11; protected System.Web.UI.WebControls.DataGrid DataGrid1; private void Page_Load (object sender, System.EventArgs e) {// in Place the user code to initialize the page sqldataadapter1.fill (this.DataSet11); this.dataGrid1.datasource = this.dataSet11.tables [0]; this.Database ();}</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 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>Grid.htc file: / ** * <p> Title: DataGrid Drake line on the page (in the header, implementing the HTC file) </ p> * <p> Description: DataGrid Drake line on the page (in the head Implementation with HTC files) </ p> * <p> Copyright: 2005-2005 by mail_ricklee corporation </ p> * <p> company: mail_ricklee corporation </ p> * <p> CreateTime: 2005-04-23 21 : 30 </ p> * <p> modifyTime: </ p> * @createauthor Li Wei * @version 1.0 * @ModifyAuthor * @vent> <public: attach event = "oncontentready" Onevent = "Fninit ()" /> <public: attach event = "onclick" onevent = "fnclick ()" /> <method name = "menubarpush" /> <script language = "jscript"> function fninit () {for (VAR i = 0; i <element.rows.Length; i ) {var _tr = element.rows [i]; for (var j = 0; j <_tr.cells.lend "{if (i == 0) {_tr.attachEvent ( "onmousedown", fnMousedown); _tr.attachEvent ( "onmousemove", fnMousemove); _tr.attachEvent ( "onmouseover", fnMouseover); _tr.attachEvent ( "onselectstart", fnCancel); window.document.attachEvent ("OnMouseup", fnmouseup; window.document .attachevent ("onmousemove", fnmousemove;}}</p> <p>} Var _line = window.document.createElement ("div"); _LINE.Style.Position = "absolute"; _Line.Style.BACKGROUNDCOLOR = "Silver"; _line.style.Width = 1; window.Document.body.Appendchild (_line); element.splitLine = _line; element.splitLine.style.display = "none";} function fnMouseover () {return;} function fnMouseMove () {if (! element.splitlocked) return; fnMousemove ();} function fnMousemove () {var oEl = event.srcElement; element.splitLine.style.left = window.event.x; element.splitLine.style.top = getTop (element); element.splitLine.style.height = element.parentElement .clientHeight; if (element.splitlocked) return;} function fnclick () {var Oel = event.srcelement;} function fnmousedown () {var Oel = Event.srcelement; if (! IFSPLITLOCATION (OEL)) Return; element.splitline.style.display = ""; element.splitlocked = true; window.document.attachevent ("overselectstart", fncancel);} function fnmouseup () {ELELELE ment.splitLine.style.display = "none"; element.splitlocked = false; element.document.body.style.cursor = 'default'; if (element.curResizeTD == null) return; var otd = element.curResizeTD; var otdLeft = getLeft (otd); var otdwidth = element.splitLine.style.pixelLeft - otdLeft if (otdwidth <0) return; otd.style.width = otdwidth; window.document.detachEvent ( "onselectstart", fnCancel);} Function ifsplitLocation (OEL) {if (OEL.TAGNAME == "Div") OEL = OL.Parentelement; if (OEL.TAGNAME == "TD"</p> <p>) {IF (event.offsetx - OEL.CLIENTWIDTH) <= 5) {ELEMENT.CURRESIZETD = OEL; ELEMENT.Document.body.style.cursor = 'col-resize';} else f (Math.Abs) (Event.Offsetx) <= 5 && Ol.cellindex> 0) {if (OL.CellIndex> 0) {ELEMENTLESETD = OL.Parentelement.cells (OL.CellIndex-1); element.document.body.style. Cursor = 'col-resize';}} else {element.curresizet = null; element.document.body.style.cursor = 'default'; returnif;}} Return true;} function gettop (e) {var t = E.OffSettop; while (e = E.OffsetParent) {t = E.OffSettop;} Return T;} Function Getleft (e) {var l = E.Offsetleft; while (e = E.OffSetParent) {L = E. OffsetLeft;} Return L;} Function Fncancel () {WINDOW.EVENT.RETURNVALUE = false; returnaf false;} </ script> </ public: component> new modified drag line and remove the border ^ _ ^</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-32945.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="32945" 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.046</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 = 'afMomNtqR2kn9hKXhIdr0P6j2uLP_2FZjBIZPssd3_2BsMvJla1isuEESs7MRQfFp6kM9MDY8bmTZDpv8Cn36lIcOg_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>