[ASP.NET] Supports DataGrid for UP, Down, and Pageup, Pagedown, Home, End, Enter Keyboard

xiaoxiao2021-03-06  50

A chapter code can implement a DataGrid window that supports UP, Down, and Pageup, PageDown, Home, End, ENTER keyboard operations, return the selected value to the initBox1 of the initial window after pressing the Enter.

Webform1.aspx

<% @ Page language = "c #" codebehind = "Webform1.aspx.cs" autoeventwireup = "false" inherits = "complextest.webform1"%> Webform1 </ title> <meta content =" Microsoft Visual Studio .NET 7.1 "Name =" Generator "> <meta content =" c # "name =" code_language "> <meta content = "JavaScript" name = "vs_defaultClientScript"> <meta content = "http://schemas.microsoft.com/intellisense/ie5" name = "vs_targetSchema"> <script language = "javascript"> var oldrow var currowno; var Strreturn; // Storage Return Values ​​VAR NEWCOLOR = '# c0c0c0'; var OldColor; var maxrowcount; function selectok (text) {EVAL ("Parent.opener.Document.all.TextBox1.value = text"); // Spread The window of the form returns value parent.close ();} function change (keycode) {if (keycode == 33) {// Definition PageUp key shortcut function Document.all.prevpage.click (); // call server control The corresponding function} if (keycode == 34) {// definition Pagedown key shortcut function Document.all.nextPage.Click ();} if (keycode == 36) {// Define HOM E key shortcut function Document.all.firstPage.click ();} if (keycode == 35) {// Define End key shortcut function Document.all.lastPage.click ();} if (keycode == 38) {/ / ↑ key shortcut function moveup ();} if (keycode == 40) {// key shortcut function MOVEDOWN ();} if (keycode == 37) {// ← key quick function (previous layer) // QueryParent ();} if (keycode == 39) {// → key shortcut function (next layer) // querychild ();} if (keycode ==</p> <p>13) {// Enter key Selectok (STRRETURN);}} Function RowFocus (ROWNO, STRVALUE, BFIRST) {if (bfirst! = 0) {// If not the first call, this function Oldrow.Style.BackgroundColor = Oldcolor // Set the old line to the original color} Strreturn = StrValue; // Stroller Oldrow = Document.all ('Row' rowno) in Oldrow; // Save OldColor = Document.all ('Row' Rowno) .Style.BackgroundColor; // Save the color document.all of the current row in OldColor .Style.BackgroundColor = NewColor; // Set the color of the current line Remind color currowno = rowno; // Save the current line number in Currown} Function moveup () {if (CurRowno == 0) // If it is already the last line, set the cursor to the bottom of the bottom, Currowno = maxRowCount-1; Else Currowno = CurrownNo-1; / / Otherwise, move one line Document.all ('Row' Currowno) .Click (); // Call the click function} function movedown () {if (Currown == maxRowcount-1) / / If it is already the bottom line, set the cursor to the bottom of the bottom, the row, the bottom line, the row, the row, the row, and the else currown = CurrownO 1; / / Otherwise, one line Document.all ('Row' Currowno) .Click (); / script> <script language = "javascript" Event = "onkeydown" for = "document"> if (event.keycode == 34 || Event.Keycode == 33 || Event.keycode == 35 || Event.keycode == 36 || Event.keycode == 37 || Event.keycode == 38 || Event.KeyCode == 39 || Event.KeyCode == 40 || Event.keycode == 13) {change.com (event.keycode); // change page display} if (event.keycode == 27) Parent.close (); // Press the ESC button to exit </ script> <Style> .hidetr {visibility: hidden} </ stop> </ head> <body ms_positioning = "gridLayout> <form id =" form1 "method =" post "runat =</p> <p>"Server"> <font face = "Song" style = "font-size: x-small; font-family: Song"> <ask: DataGrid ID = dataGrid1 style = "z-index: 101; Left: 8px; position : absolute; TOP: 8px "runat =" server "Width =" 520px "DataSource =" <% # dataSet21%> "DataMember =" Customers "AllowPaging =" True "AutoGenerateColumns =" ​​False "BorderColor =" # 3366CC "BorderStyle = "None" borderwidth = "1px" backcolor = "white" cellpadding = "4" font-size = "x-small"> <footerStyle wrap = "false" forcolor = "# 003399" cssclass = "hidetr" backcolor = "# 99CCCC "> </ FooterStyle> <SelectedItemStyle Font-Bold =" True "Wrap =" False "ForeColor =" # CCFF99 "BackColor =" # 009999 "> </ SelectedItemStyle> <EditItemStyle Wrap =" False "> </ EditItemStyle> <AlternatingItemStyle Wrap = "False"> </ AlternatingItemStyle> <ItemStyle Wrap = "False" ForeColor = "# 003399" BackColor = "White"> </ ItemStyle> <HeaderStyle Font-Bold = "True" Wrap = "False" ForeColor = "# Ccccff" backcolor = "# 003399"> </ headerstyle> <columns> <ask: BoundColumn Datafield = "Customerid" sortexpression = "Custom Erid "Headertext =" User No. "> <headerstyle wrap =" false "> </ headerstyle> <itemstyle wrap =" false "> </ itemstyle> <footerStyle Wrap =" false "></p> <p></ FooterStyle> </ asp: BoundColumn> <asp: BoundColumn DataField = "CompanyName" SortExpression = "CompanyName" HeaderText = "Name"> <HeaderStyle Wrap = "False"> </ HeaderStyle> <ItemStyle Wrap = "False" > </ ItemStyle> <FooterStyle Wrap = "False"> </ FooterStyle> </ asp: BoundColumn> <asp: BoundColumn DataField = "ContactName" SortExpression = "ContactName" HeaderText = "contact"> <HeaderStyle Wrap = "False "> </ Headerstyle> <itemStyle wrap =" false "> </ itemstyle> <footerStyle Wrap =" false "> </ footerStyle> <asp: boundcolumn> <ask: boundcolumn datafield =" address "sortexpression =" address " Headertext = "Address"> <headerstyle wrap = "false"> </ headersty> <itemStyle wrap = "false"> </ itemStyle> <footerStyle wrap = "false"> </ footerStyle> </ asp: boundcolumn> </ Columns> <PagerStyle HorizontalAlign = "Left" ForeColor = "# 003399" BackColor = "# 99CCCC" Wrap = "False" Mode = "NumericPages"> </ PagerStyle> </ asp: datagrid> <asp: label id = "lblPageCount "style =" z-index: 102 Left: 16px; position: absolute; Top: 288px "Runat =" server "width =" 224px "> label </ ask: button id =" prevpage "style =" z-index: 103; Left : 352px; Position: absolute; top: 280px "runat ="</p> <p>Server "text =" <"width =" 24px "> </ asp: button> <ask: button id =" newpage "style =" z-index: 104; Left: 376px; position: absolute; top: 280px "RUNAT = "Server" text = ">" width = "25px"> </ asp: button> <ask: button id = "firstpage" style = "z-index: 105; Left: 400px; position: absolute; top: 280px "Runat =" text = "| <" width = "24px"> </ asp: button> <ask: button id = "LastPage" style = "z-index: 106; Left: 424px; Position: absolute; TOP: 280px "Runat =" server "text ="> "width =" 28px "> </ asp: button> <ask: textbox id =" txtpageIndex "style =" z-index: 107; Left: 256px; position : Absolute; Top: 280px "Runat =" server "width =" 40px "> </ asp: textbox> <ask: button id =" gotopage "style =" z-index: 108; Left: 304px; position: absolute; TOP: 280px "Runat =" server "text =" Go to "</ asp: button> <ask: regularExpressionValidator id =" REGULAREXPRESSIONVALIDATOR1 "style =" z-index: 109; Left: 256px; position: absolute; top: 312px "Runat =" Server "ErrorMessage =" requires input integers "ValidationExpression =" / D "ControlToValidate =" TX TpageIndex> </ ask: regularExpressionValidator> </ font> </ form> </ body> </ html> Webform1.aspx.cs</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; Namespace complexTest {/// <summary> /// WebForm1 summary description. /// </ summary> public class WebForm1: System.Web.UI.Page {protected System.Data.SqlClient.SqlConnection sqlConnection1; protected System.Web.UI.WebControls.Button PrevPage; protected System.Web.UI.WebControls. Button NextPage; protected System.Data.SqlClient.SqlCommand sqlSelectCommand2; protected System.Data.SqlClient.SqlCommand sqlInsertCommand2; protected System.Data.SqlClient.SqlCommand sqlUpdateCommand2; protected System.Data.SqlClient.SqlCommand sqlDeleteCommand2; protected System.Data.SqlClient. SqlDataAdapter sqlDataAdapter1; protected ComplexTest.DataSet2 dataSet21; protected System.Web.UI.WebControls.Button FirstPage; protected System.Web.UI.WebControls.Button LastPage; protected System.Web.UI.WebControls.Label lblPageCount; protected System.Web. UI.WebControls.Button GotoPage; protected System.Web.UI.WebControls.TextBox txtPageIndex; protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1; protected System.Web.UI.WebControls .DataGrid DataGrid1; private void page_load (object sender, system.eventargs e) {// Place the user code here to initialize the page if (! Ispostback) {myDatabase ();}} #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.sqlConnection1 = new System.Data.SqlClient.SqlConnection (); this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand (); this.sqlInsertCommand2 = new System. Data.SqlClient.SqlCommand (); this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand (); this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand (); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter (); this.dataSet21 = new ComplexTest.DataSet2 (); ((System.ComponentModel.ISupportInitialize) (this.dataSet21)) BeginInit ();. this.DataGrid1.ItemDataBound = new System.Web.UI.WebControls.DataGridItemEventHandler (this.DataGrid1_ItemDataBound); this.PrevPage.Click = new System.EventHandler (this.Button1_Click); this.NextPage.Click = new System.EventHandler (this.Button2_Click); this.FirstPage.Click = new System. EventHandler (this.btnfirst_click; this.lastpage.click = new system.eventhandler (this.btnlast_click); this.gotopa ge.Click = new System.EventHandler (this.GotoPage_Click); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "workstation id = SOHO; packet size = 4096; user id = sa; data source = SOHO; persist security " " info = False; initial catalog = Northwind "; // // sqlSelectCommand2 // this.sqlSelectCommand2.CommandText =" SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, " " PostalCode, Country, Phone, Fax from Customers "; this.sqlselectcommand2.connection = this.sqlConnection1;</p> <p>// // sqlInsertCommand2 // this.sqlInsertCommand2.CommandText = @ "INSERT INTO Customers (CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax) VALUES (@CustomerID, @CompanyName, @ ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax); SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE (CustomerID = @CustomerID) "; this.sqlInsertCommand2.Connection = this.sqlConnection1; this.sqlInsertCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter (" @ CustomerID ", System.Data.SqlDbType.NVarChar, 5, "CustomerID")); this.sqlInsertCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ CompanyName", System.Data.SqlDbType.NVarChar, 40, "CompanyName")); this.sqlInsertCommand2. Parameters.add (new system.data.sqlclient.sqlparameter ("@ contactname", system.data.sqldbtype.nvarchar, 30, "contactname"); th is.sqlInsertCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ ContactTitle", System.Data.SqlDbType.NVarChar, 30, "ContactTitle")); this.sqlInsertCommand2.Parameters.Add (new System.Data .SqlClient.SqlParameter ( "@ Address", System.Data.SqlDbType.NVarChar, 60, "Address")); this.sqlInsertCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ City", System. Data.sqldbtype.nvarchar, 15, "city"); this.sqlinsertcommand2.parameters.add (new system.data.sqlclient.sqlparameter ("@ region"</p> <p>System.data.sqldbtype.nvarchar, 15, "region"); this.sqlinsertcommand2.parameters.add (new system.data.sqlclient.sqlparameter ("@ posthalcode", system.data.sqldbtype.nvarchar, 10, " PostalCode ")); this.sqlInsertCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter (" @ Country ", System.Data.SqlDbType.NVarChar, 15," Country ")); this.sqlInsertCommand2.Parameters.Add (New system.data.sqlclient.sqlparameter ("@ phone", system.data.sqldbtype.nvarchar, 24, "phone")); this.sqlinsertCommand2.Parameters.add (new system.data.sqlclient.sqlparameter ("@ Fax ", System.Data.SqlDbType.NVarChar, 24," Fax ")); // // sqlUpdateCommand2 // this.sqlUpdateCommand2.CommandText = @" UPDATE Customers SET CustomerID = @CustomerID, CompanyName = @CompanyName, ContactName = @ ContactName, ContactTitle = @ContactTitle, Address = @Address, City = @City, Region = @Region, PostalCode = @PostalCode, Country = @Country, Phone = @Phone, Fax = @Fax WHERE (CustomerID = @Original_CustomerID) AND ( Address = @orig inal_Address OR @Original_Address IS NULL AND Address IS NULL) AND (City = @Original_City OR @Original_City IS NULL AND City IS NULL) AND (CompanyName = @Original_CompanyName) AND (ContactName = @Original_ContactName OR @Original_ContactName IS NULL AND ContactName IS NULL) AND (ContactTitle = @ORIGINAL_CONTACTTITLE or @original_contacttitle is null and contactttitle is null) and (country = @ORIGINAL_COUNTRY @original_country is null and country is null) and (fax = @</p> <p>Original_Fax OR @Original_Fax IS NULL AND Fax IS NULL) AND (Phone = @Original_Phone OR @Original_Phone IS NULL AND Phone IS NULL) AND (PostalCode = @Original_PostalCode OR @Original_PostalCode IS NULL AND PostalCode IS NULL) AND (Region = @Original_Region OR @Original_Region IS NULL AND Region IS NULL); SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE (CustomerID = @CustomerID) "; this.sqlUpdateCommand2.Connection = this .sqlConnection1; this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ CustomerID", System.Data.SqlDbType.NVarChar, 5, "CustomerID")); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ CompanyName", System.Data.SqlDbType.NVarChar, 40, "CompanyName")); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ ContactName" , System.data.sqldbtype.nvarchar, 30, "contactname")); this.sqlupdateCommand2.parame ters.Add (new System.Data.SqlClient.SqlParameter ( "@ ContactTitle", System.Data.SqlDbType.NVarChar, 30, "ContactTitle")); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ("@Address", system.data.sqldbtype.nvarchar, 60, "address")); this.sqlupdateCommand2.Parameters.add (new system.data.sqlclient.sqlparameter ("@ city", system.data.sqldbtype. NVARCHAR, 15, "city"); this.sqlupdateCommand2.Parameters.add (new system.data.sqlclient.sqlparameter ("@ region", system.data.sqldbtype.nvarchar, 15, "region");</p> <p>this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ PostalCode", System.Data.SqlDbType.NVarChar, 10, "PostalCode")); this.sqlUpdateCommand2.Parameters.Add (new System.Data .SqlClient.SqlParameter ( "@ Country", System.Data.SqlDbType.NVarChar, 15, "Country")); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Phone", System. Data.sqldbtype.nvarchar, 24, "phone"); this.sqlupdateCommand2.parameters.add (new system.data.sqlclient.sqlparameter ("@ fax", system.data.sqldbtype.nvarchar, 24, "fax") ); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_CustomerID", System.Data.SqlDbType.NVarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte) (0)), ((system.byte) (0)), "Customerid", System.Data.DataRowVersion.original, NULL); this.sqlupdateCommand2.parameters.add (new system.data.sqlclient.sqlparameter) @ORIGINAL_ADDRESS ", System.Data.sqldbtype.nvarchar, 60, System.Data.ParameterDirection .NPUT, FALSE ((System.byte) ((System.byte) (0)), "Address", System.Data.DataRowVersion.original, Null); this.sqlupdateCommand2.parameters.add (New system.data.sqlclient.sqlparameter ("@ original_city", system.data.sqldbtype.nvarchar, 15, system.data.parameterDirection.Input, false, ((System.byte) (((System.)) Byte) (0)), "City", system.data.datarowversion.original, null); this.sqlupdateCommand2.Parameters.add (new system.data.sqlclient.sqlparameter ("@ Original_companyname"</p> <p>System.data.sqldbtype.nvarchar, 40, system.data.parameterDirection.input, false, ((System.byte) ((System.byte) (0)), "CompanyName", System.data .DataRowVersion.Original, null)); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_ContactName", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, false ((System.byte) (0)), "ContactName", System.Data.DataRowVersion.original, NULL); this.sqlupdateCommand2.Parameters.Add (New System. Data.sqlclient.sqlparameter ("@ Original_ContactTitTitle", System.Data.sqldbtype.nvarchar, 30, System.Data.ParameterDirection.Input, False, ((System.byte)) ((System.byte) (0) )), "ContactTitle", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Country", System.Data.SqlDbType.NVarChar, 15 System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0)), "Country", System.Data.D ataRowVersion.Original, null)); this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Fax", System.Data.SqlDbType.NVarChar, 24, System.Data.ParameterDirection.Input, false, ((System.byte) (0)), "Fax", System.Data.DataRowVersion.original, Null); this.sqlupdateCommand2.Parameters.Add (New System.Data . Sqlclient.sqlparameter ("@ original_phone", system.data.sqldbtype.nvarchar, 24, system.data.parameterDirection.Input, false, ((System.byte)), ((System.byte) (0) ), "Phone", system.data.datarowversion.original, null);</p> <p>this.sqlUpdateCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_PostalCode", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte) (0 )), (System.byte) (0)), "postalcode", system.data.datarowversion.original, null); this.sqlupdateCommand2.parameters.add (new system.data.sqlclient.sqlparameter) ", System.data.sqldbtype.nvarchar, 15, system.data.parameterDirection.input, false, ((System.byte) ((System.byte))," Region ", System. Data.DataRowVersion.Original, null)); // // sqlDeleteCommand2 // this.sqlDeleteCommand2.CommandText = @ "DELETE FROM Customers WHERE (CustomerID = @Original_CustomerID) AND (Address = @Original_Address OR @Original_Address IS nULL AND Address IS nULL ) AND (City = @Original_City OR @Original_City IS NULL AND City IS NULL) AND (CompanyName = @Original_CompanyName) AND (ContactName = @Original_ContactName OR @Original_ContactName IS NULL AND ContactName IS NULL) AND (Cont actTitle = @Original_ContactTitle OR @Original_ContactTitle IS NULL AND ContactTitle IS NULL) AND (Country = @Original_Country OR @Original_Country IS NULL AND Country IS NULL) AND (Fax = @Original_Fax OR @Original_Fax IS NULL AND Fax IS NULL) AND (Phone = @Original_Phone OR @Original_Phone IS NULL AND Phone IS NULL) AND (PostalCode = @Original_PostalCode OR @Original_PostalCode IS NULL AND PostalCode IS NULL) AND (Region = @Original_Region OR @Original_Region IS NULL AND Region IS NULL) "; this.sqlDeleteCommand2. Connection = this.sqlConnection1;</p> <p>this.sqlDeleteCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_CustomerID", System.Data.SqlDbType.NVarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte) (0 )), (System.byte) (0)), "Customerid", System.Data.DataRowVersion.original, null); this.sqldeleteCommand2.Parameters.add (new system.data.sqlclient.sqlparameter) ", System.data.sqldbtype.nvarchar, 60, system.data.parameterDirection.input, false, ((System.byte)), ((System.byte) (0))," Address ", System. Data.DataRowVersion.Original, null)); this.sqlDeleteCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_City", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0)), "City", System.Data.DataRowVersion.original, Null); this.sqldeleteCommand2.Parameters.Add (New System) .DATA.SQLCLIENT.SQLPARAMETER ("@ Original_companyName", System.Data.Sqldbtype.Nvarchar, 40, System.Data.ParameterDirection.i NPUT, FALSE, ((System.byte) ((System.byte) (0)), "CompanyName", System.Data.DataRowVersion.Riginal, Null); this.sqldeleteCommand2.Parameters.Add ( new System.Data.SqlClient.SqlParameter ( "@ Original_ContactName", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte) (0)), ((System.Byte ) (0)), "ContactName", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_ContactTitle", System.Data.SqlDbType. NVARCHAR, 30, System.Data.ParameterDirection.Input, false, ((System.byte) ((System.byte) (0)), "</p> <p>ContactTitle ", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter (" @ Original_Country ", System.Data.SqlDbType.NVarChar, 15, System.Data .ParameterDirection.input, false (0)), (System.byte) (0)), "Country", System.Data.DataRowVersion.ORIGINAL, NULL); this.sqldeleteCommand2.parameters .Add (new system.data.sqlclient.sqlparameter ("@ original_fax", system.data.sqldbtype.nvarchar, 24, system.data.parameterDirection.input, false, ((System.byte) (0)), System.byte) (0)), "fax", system.data.datarowversion.original, null); this.sqldeleteCommand2.Parameters.add (new system.data.sqlclient.sqlparameter ("@ Original_Phone", System.Data . Sqldbtype.nvarchar, 24, System.Data.ParameterDirection.Input, False, (System.byte) ((System.byte) (0)), "Phone", System.Data.DataRowVersion.original , null); this.sqldeleteCommand2.Parameters.add (new system.data.sqlclient.sqlparameter ("@ Original_Postalcode", System.Data.sqldbt Ype.nvarchar, 10, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0)), "Postalcode", System.Data.DataRowVersion.ORIGINAL, null)); this.sqlDeleteCommand2.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Region", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((System. BYTE) (0)), (system.byte) (0)), "region", system.data.datarowversion.original, null); // // sqldataadapter1 // this.sqldataadapter1.deleteCommand = this.sqldeleteCommand2 This.sqldataadapter1.insertcommand = this.sqlinsertCommand2; this.sqldataadapter1.selectCommand =</p> <p>this.sqlSelectCommand2; this.sqlDataAdapter1.TableMappings.AddRange (new System.Data.Common.DataTableMapping [] {new System.Data.Common.DataTableMapping ( "Table", "Customers", new System.Data.Common.DataColumnMapping [] {new System.Data.Common.DataColumnMapping ( "CustomerID", "CustomerID"), new System.Data.Common.DataColumnMapping ( "CompanyName", "CompanyName"), new System.Data.Common.DataColumnMapping ( "ContactName", "ContactName"), new System.Data.Common.DataColumnMapping ( "ContactTitle", "ContactTitle"), new System.Data.Common.DataColumnMapping ( "Address", "Address"), new System.Data.Common.DataColumnMapping ( "City", "city"), new System.Data.Common.DataColumnMapping ( "Region", "Region"), new System.Data.Common.DataColumnMapping ( "PostalCode", "PostalCode"), new System.Data.Common.DataColumnMapping ( "Country", " Country "), new system.data.common.datacolumnmapping (" Phone "," Phone "), new system.data.common.datacolumnmapping (" fax ","</p> <p>Fax ")})}); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand2; // // dataSet21 // this.dataSet21.DataSetName =" DataSet2 "; this.dataSet21.Locale = new System.Globalization.CultureInfo (" zh -CN "); this.Load = new System.EventHandler (this.Page_Load); ((System.ComponentModel.ISupportInitialize). (this.dataSet21)) EndInit ();} #endregion private void DataGrid1_ItemDataBound (object sender, System .Web.ui.webcontrols.dataGriditeMeventargs e) {itm.itemtype == listitemtype.item) || (E.Item.itemType == ListItemType.alternatingItem) {string strfield = E.Item.cells [ 0] .Text; // Specify the field to return, is currently row, can be changed to other fields E.Item.attributes.add ("OnDBLClick", "SELECTOK ('" strfield ")") ; // You can also return when you double-click E.Item.attributes.add ("Onclick", RowFocus (" E.Item.Item.Index ", '" Strfield ", 1) "); // Click When performing the line E.Item.attributes.add ("ID", "Row" E.Item.itemindex); // gives a name to each line in the table to facilitate the client code call IF (E.Item. ItemIndex == 0) // Set the JavaScript statement when initialization {CreateJavaScript (Strfield, DataGrid1.pageSize); // Initialize client code} //e.item.attributes.add("onmouseover ""rowfocus(" e.item.itemindex " ,'" e.Item.cells[0].text " ', 1) ");}} private void CreateJavascript (string colValue, int PageSize) {// Javascript initialization statement screen, highlighting the row set to the primary line and set the number of page rows String scriptString =" <script language = javascript> "; scriptString = "MaxRowcount =" Pagesize ";" // Set the maximum number of rows to client code Scriptstring = "RowFocus (0, '" colvalue </p> <p>"', 0)"; // Set the cursor to the first line Scriptstring = "<.isstartupScriptregistered (" Startup ") This.RegisterStartupScript (" Startup ", ScriptString );} private void Button1_Click (object sender, System.EventArgs e) {if (DataGrid1.PageCount> 0) {if (DataGrid1.CurrentPageIndex> 0) {DataGrid1.CurrentPageIndex = DataGrid1.CurrentPageIndex-1; MyDataBind ();}} } private void Button2_Click (object sender, System.EventArgs e) {if (DataGrid1.PageCount> 0) {if (DataGrid1.CurrentPageIndex <DataGrid1.PageCount-1) {DataGrid1.CurrentPageIndex = DataGrid1.CurrentPageIndex 1; MyDataBind (); }}} private void btnFirst_Click (object sender, System.EventArgs e) {if (DataGrid1.PageCount> 0) {DataGrid1.CurrentPageIndex = 0; MyDataBind ();}} private void btnLast_Click (object sender, System.EventArgs e) { IF (DataGrid1.PageCount> 0) {dataGrid1.currentpageIndex = DataGrid1.pa geCount-1; MyDataBind ();}} private void MyDataBind () {sqlDataAdapter1.Fill (dataSet21); DataGrid1.DataBind (); if (DataGrid1.PageCount> 0) {int PageIndex = DataGrid1.CurrentPageIndex 1; lblPageCount.Text = "Total" DataGrid1.PageCount "page, current to" pageIndex.toString () "page"; txtpageIndex.text = pageindex.toString ();}} private void gotopage_click (Object Sender, System.EventArgs E) {IF (DataGrid1.PageCount> 0) {if (txtpageIndex.text.length> 0) {INT i = convert.Toint16 (txtpageindex.text) -1; if ((i <dataGrid1.pagecount) && (i> =</p> <p>0) {dataGrid1.currentpageIndex = i; mydatabase ();}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}</p> <p><% @ Page language = "c #" codebehind = "index.aspx.cs" autoeventwireup = "false" inherits = "complextest.index"%> <! Doctype html public "- // w3c // DTD HTML 4.0 Transitional // En "> <html> <head> <title> index </ title> <meta content =" Microsoft Visual Studio .NET 7.1 "Name =" Generator "> <meta content =" c # "name =" code_language "> <meta content = "JavaScript" name = "vs_defaultClientScript"> <meta content = "http://schemas.microsoft.com/intellisense/ie5" name = "vs_targetSchema"> <script language = "javascript"> function Search () // Choose delivery unit {var strurl; strurl = "Webform1.aspx"; window.open (Strull, "SELECT_ONE_BASE", "Toolbar = NO, MenuBar = no, resizable = yes, top = 0, left = 0, width = 720pt , Height = 460pt ");} </ script> <script for =" document "Event =" onkeydown "Language =" javascript "> if (event.keycode == 27) {WINDOW.OPENER = 'Anyone'; Window. Close ();} </ script> <style> .flattext {font-size: x-small; border-top-style: none; border-bottom: black 1px solid; font-family: Song; Border-Right-Style : NONE Border-left-style: none} .seltext {font-size: x-small; border-top-style: none; border-bottom: black 1px solid; font-family: Song; Border-Right-Style: None; Border-left-style: none; background-color: # ffcc66} </ stop> </ head> <body ms_positioning = "gridLayout> <form id =" form1 "method =" post "runat =" server "</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-81596.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="81596" 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.044</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 = '17U5VJkYTBI7rQ_2F2DU0HMpozNatKFkHM1_2FC3suJgKEJgSiahr1yLFAVzAOVVLdT_2BJq60SPESpON_2FaYdp'; 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>