DataGrid multi-line outside the editing state

zhaozj2021-02-16  53

<% @ Page language = "c #" codebehind = "main.aspx.cs" autoeventwireup = "false" inherits = "test1.webform6"%> Webform6 </ 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"> <LINK href = "xpTable.css" type = "text / CSS "rel =" stylesheet "> <script> function change_style (font) {font.style.textalign =" left "; font.style.color =" # ff0033 "; font.style.fontweight =" bold "; font. SIZE = 17;} function keydown () {if (event.keycode == 13) {event.keycode = 9; return true;}}</p> <p>Document.οkeydοwn = keydown;</p> <p></ script> </ head> <body ms_positioning = "gridLayout"> <form id = "form1" method = "post" runat = "server"> <font face = "Song"> <font size = "6"> <p align = "center"> <ask: label id = "name" font-size = "20pt" runat = "server"> </ asp: label> table entry <input id = "9cbs" style = "z -Index: 101; Left: 504px; Position: Absolute; Top: 24px "Type =" text "> </ p> </ font> <ask: DataGrid ID =" DataGrid1 "runat =" font-size = " 9pt "DatakeyField =" ID "autogeneratecolumns =" ​​false "height =" 195px "width =" 1854px "> <footerStyle font-size =" 9pt "horizontalalign =" left "forcolor =" red "backcolor =" Aqua "> </ FooterStyle> <AlternatingItemStyle Font-Size = "9pt" HorizontalAlign = "Left" BackColor = "# E8F4FF"> </ AlternatingItemStyle> <Columns> <asp: BoundColumn DataField = "ID" ReadOnly = "True" HeaderText = "ID"> </ asp: BoundColumn> <asp: BoundColumn DataField = "CustomerName" ReadOnly = "True" HeaderText = "CustomerName"> </ asp: BoundColumn> <asp: BoundColumn DataField = "OrderNo" ReadOnly = "True" HeaderText = "OrderNo "> </ asp: boundcolumn> <Ask: boundcolumn datafield = "gaugeid" readonly = "true" Headertext = "gaugeID"> </ asp: boundcolumn> <</p> <p>asp: TemplateColumn HeaderText = "NewFread"> <ItemTemplate> <asp: TextBox id = "NewFread" Runat = server Text = '<% # DataBinder.Eval (Container.DataItem, "NewFread")%>' CssClass = "inputcss" οnchange = "Change_Style (this)"> </ asp: TextBox> </ ItemTemplate> </ asp: TemplateColumn> <asp: TemplateColumn HeaderText = "NewTread"> <ItemTemplate> <asp: TextBox id = "NewTread" Runat = server Text = '<% # DataBinder.eval (Container.DataItem, "NewTread")%>' cssclass = "infutcss" οnchange = "change_style (this)> </ asp: textbox> </ itemtemplate> </ asp: templateColumn > <asp: TemplateColumn HeaderText = "NewGread"> <ItemTemplate> <asp: TextBox id = "NewGread" Runat = server Text = '<% # DataBinder.Eval (Container.DataItem, "NewGread")%>' CssClass = " inputcss "οnchange =" Change_Style (this) "> </ asp: TextBox> </ ItemTemplate> </ asp: TemplateColumn> <asp: BoundColumn DataField =" OldFread "ReadOnly =" True "HeaderText =" OldFread "> </ asp : BoundColumn> <ask: bou ndColumn DataField = "OldTread" ReadOnly = "True" HeaderText = "OldTread"> </ asp: BoundColumn> <asp: BoundColumn DataField = "OldGread" ReadOnly = "True" HeaderText = "OldGread"> </ asp: BoundColumn> < ASP: BoundColumn Datafield = "Showntpower" Readonly = "</p> <p>True "HeaderText =" ShowTpower "> </ asp: BoundColumn> <asp: BoundColumn DataField =" OutTpower "ReadOnly =" True "HeaderText =" OutTpower "> </ asp: BoundColumn> <asp: BoundColumn DataField =" losspower "ReadOnly = "True" HeaderText = "losspower"> </ asp: BoundColumn> <asp: BoundColumn DataField = "lineloss" ReadOnly = "True" HeaderText = "lineloss"> </ asp: BoundColumn> <asp: BoundColumn DataField = "RealTpower "ReadOnly =" True "HeaderText =" RealTpower "> </ asp: BoundColumn> <asp: BoundColumn DataField =" Ltfee "ReadOnly =" True "HeaderText =" Ltfee "> </ asp: BoundColumn> <asp: BoundColumn DataField = "Powerfee" ReadOnly = "True" HeaderText = "Powerfee"> </ asp: BoundColumn> <asp: BoundColumn DataField = "Capacityfee" ReadOnly = "True" HeaderText = "Capacityfee"> </ asp: BoundColumn> <asp: BoundColumn DataField = "totfee" ReadOnly = "True" HeaderText = "totfee"> </ asp: BoundColumn> <asp: BoundColumn DataField = "AccMonth" ReadOnly = "True" HeaderText = "AccMonth"> </ asp: BoundColumn> <asp : BoundColumn Datafield = "Gaugename" REA dOnly = "True" HeaderText = "GaugeName"> </ asp: BoundColumn> <asp: BoundColumn DataField = "minus" ReadOnly = "True" HeaderText = "minus"> </ asp: BoundColumn> <asp: BoundColumn DataField = "</p> <p>GaugeTypeid "ReadOnly =" True "HeaderText =" GaugeTypeid "> </ asp: BoundColumn> <asp: BoundColumn DataField =" CustomerId "ReadOnly =" True "HeaderText =" CustomerId "> </ asp: BoundColumn> <asp: BoundColumn DataField = "SimpleCustomer" readonly = "true" Headertext = "SimpleCustomer"> </ asp: boundcolumn> </ color> </ font> <table> <tr> <td> <asp: button id = "Uptable" text = "Update to Table" runat = "server" cssclass = "redbuttoncss"> </ askBUTTON> </ TD> <TD> <ask: button id = "Updatabase" width = "80px" text = "Update to the Database" runat = "server" cssclass = "redbuttoncss"> </ askBUTTON> </ TD> <TD> <asp: button id = "can" width = "80px" text = "Cancel" runat = "Server" cssclass = "redbuttoncss"> </ askTONCSS> </ asp: button> </ td> </ tr> </ table> </ form> </ body> </ html> 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>Summary description of Namespace Test1 {/// <summary> /// WebForm6. /// </ summary> public class WebForm6: System.Web.UI.Page {protected System.Data.OleDb.OleDbDataAdapter oleDbData; protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1; protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1; protected System.Data.OleDb.OleDbConnection oleDbConnection1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.DataGrid DataGrid1; long id = 2; protected System.Web.UI.WebControls.Button Button2; protected System.Web.UI.WebControls.Button Button3; protected System.Web.UI.WebControls.Button UpTable; protected System.Web.UI.WebControls.Button UpDataBase; protected System.Web.UI.WebControls.Button CanCle; protected System .Web.ui.WebControls.Label Name; Long Accmonth = 200402; Private Void Page_load (Object Sender, System.EventArgs E) {// Place user code here to initialize page if (! This.ispostback) {this.cache .Remove ("lion"); // this.name.text = this.Request.queryString ["Date"]; id = C Onvert.Toint64 (this.Request.queryString ["ID"]); acmonth = communication.toint64 ("YYYYMM"); this.binddata (id, acmonth);}} private void Edit_Power () {For (int i = 0; i <this.dataGrid1.items.count; i ) {</p> <p>DataGridItem item = this.dataGrid1.items [i]; string temp = (item.cells [6] .FindControl ("newgread"))). Text; int flag= convert.Toint32 (TEMP); if (IF); if (FLAG == 0) || (FLAG == 7) || (FLAG == 8)) {(System.web.ui.WebControls.TextBox) (item.cells [4] .FindControl ("newfread") )))). Style.Add ("text-align", "center"); (Item.cells [4] .FindControl ("newfread")). Style.add ("Color", "Red"); (Item.cells [5] .FindControl ("NewTREAD"))). style.add ("text-align", " "); ((System.web.ui.WebControls.TextBox) (Item.cells [5] .FindControl (" NewTRead "))). Style.Add (" Color "," Red "); ((System.); Web.ui.webcontrols.textbox) (item.cells [6] .FindControl ("newgread")))). Style.Add ("Text-Align", "Center"); ((System.Web.ui.WebControls). TextBox (item.cells [6] .FindControl ("newgread")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))). Style.Add ("Color", "Red");} else {(System.Web.ui.WebControls.TextBox) (Item. Cells [4] .findControl ("NewFread" ))))). Readonly = true; ((Item.cells [4] .FindControl ("newfread")). TabINDEX = System.Int16.maxValue; ((System.Web) . .UI.WebControls.TextBox) (item.Cells [5] .FindControl ( "NewTread"))) ReadOnly = true; ((System.Web.UI.WebControls.TextBox) (item.Cells [4] .FindControl ( "NewTread"))))))). TabINDEX = System.Int16.maxvalue; ((Item.cells [6] .FindControl ("newgread")). Style.add ("textd"). Style.add ("Text)). Style.Add -Align "," center ");</p> <p>(System.web.ui.webcontrols.textbox) (item.cells [6] .findControl ("newgread")))))))))))))))))). Style.Add ("Color", "Red");}}} .Int64 bookid, system.int64 acmonth) {dataable table = (dataable) cache ["lion"]; if (table == null) {Table = new data ("table"); Datacolumn mycolumn = new datacolumn (); mycolumn .DataType = System.Type.GetType ( "System.Int32"); myColumn.ColumnName = "ID"; myColumn.AutoIncrement = true; myColumn.AutoIncrementSeed = 1; myColumn.AutoIncrementStep = 1; table.Columns.Add (myColumn) This.oledbdata.selectCommand.Parameters ["@ bookid"]. Value = bookid; this.oledbdata .selectCommand .parameters ["@ acmonth"]. Value = acmonth; this.oledbdata.Fill (Table); cache ["lion "] = table;} this.DataGrid1.DataKeyField =" ID "; this.DataGrid1.DataSource = table; this.DataGrid1.DataBind (); Edit_Power ();} private void add_row (DataTable dt, int ID, string NewFread, String newtread, string newgread) {TRY {for (INT i = 0; i <dt.rows.count; i ) {DATAROW ROW = DT.ROWS [I]; if ((int) row ["id"] == id) {row ["newfread"] = Newfread; row ["newgread"] = newgread; row ["newtread"] = newtread;}</p> <p>}</p> <p>Catch (Exception EX) {}</p> <p>} Private void updata_table () {Try {dataable DT = ((DATATABLE) (Cache ["lion"]); string newfread = "0"; string newgread = "0"; string newTread = "0"; int id = 0; for (int i = 0; i <this.dataGrid1.items.count; i ) {dataGridItem dgitem = this.dataGrid1.items [i]; id = (int) this.dataGrid1.dataKeys [DGItem.itemindex]; NewFread = (TextBox) Dgitem.cells [4] .controls [1]). Text; newTread = ((TextBox) Dgitem.cells [5] .controls [1]). Text; newgread = ((TextBox) DGItem. Cells [6] .controls [1]). Text; this.add_row (DT, ID, NewFread, NewTread, NewGread);} cache ["lion"] = dt; this.binddata (this.accmonth) Catch (Exception EX) {}} private void update_database () {this.Oledbdata.Update ((DataTable) cache ["lion"]); (DataTable) Cache ["lion" cache ["lion"]) .Acceptchanges ();</p> <p>}</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.oleDbData = new System.Data.OleDb.OleDbDataAdapter (); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand (); this.oleDbConnection1 = new System. Data.OleDb.OleDbConnection (); this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand (); this.UpTable.Click = new System.EventHandler (this.UpTable_Click); this.UpDataBase.Click = new System. EventHandler (this.UpDataBase_Click); this.CanCle.Click = new System.EventHandler (this.CanCle_Click); // // oleDbData // this.oleDbData.SelectCommand = this.oleDbSelectCommand1; this.oleDbData.TableMappings.AddRange (new System.Data.Common.DataTableMapping [] {new System.Data.Common.DataTableMapping ( "Table", "Web_GaugeDataInput", new System.Data.Common.DataColumnMapping [] {new System.Data.Common.DataColumnMapping ( "CustomerName" "Customername", new System.Data.Common.DataColumnMapping ( "OrderNo", "OrderNo"), new System.Data.Common.DataColumnMapping ( "GaugeId", "GaugeId"), new System.Data.Common.DataColumnMapping ( "NewFread", " "), New system.data.common.datacolumnmapping (" newTread "," newTread "), new system.data.common.DatacolumnMapping (" newgread "," newgread "</p> <p>), New System.Data.Common.DataColumnMapping ( "OldFread", "OldFread"), new System.Data.Common.DataColumnMapping ( "OldTread", "OldTread"), new System.Data.Common.DataColumnMapping ( "OldGread" , "OldGread"), new System.Data.Common.DataColumnMapping ( "ShownTPower", "ShownTPower"), new System.Data.Common.DataColumnMapping ( "OutTpower", "OutTpower"), new System.Data.Common.DataColumnMapping ("Adjusttpower", "AdjustTpower"), New System.Data.common.DatacolumnMapping ("Losspower", "Losspower"), new system.data.common.DatacolumnMapping ("LINELOSS", "LINELOSS"), new System.Data.Common.DataColumnMapping ( "RealTpower", "RealTpower"), new System.Data.Common.DataColumnMapping ( "Ltfee", "Ltfee"), new System.Data.Common.DataColumnMapping ( "Powerfee", " Powerfee "), new system.data.common.datacolumnmapping (" Capacityfee "," Capacityfee "</p> <p>), New System.Data.Common.DataColumnMapping ( "totfee", "totfee"), new System.Data.Common.DataColumnMapping ( "AccMonth", "AccMonth"), new System.Data.Common.DataColumnMapping ( "GaugeName" , "GaugeName"), new System.Data.Common.DataColumnMapping ( "minus", "minus"), new System.Data.Common.DataColumnMapping ( "GaugeTypeid", "GaugeTypeid"), new System.Data.Common.DataColumnMapping ( "CustomerId", "CustomerId"), new System.Data.Common.DataColumnMapping ( "SimpleCustomer", "SimpleCustomer")})}); this.oleDbData.UpdateCommand = this.oleDbUpdateCommand1; // // oleDbSelectCommand1 // this .oledbselectcommand1.commandtext = "[ Web_GaugeDataInput] "; this.oleDbSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure; this.oleDbSelectCommand1.Connection = this.oleDbConnection1; this.oleDbSelectCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter (" @ RETURN_VALUE ", System.Data.Oledb.oledbtype.integer, 4, System.Data.ParameterDirection.ReturnValue, False, ((System.byte) ((System.byte)), "", System.Data .DATAROWVERSION.CURRENT, NULL); this.OledbselectCommand1.Parameters.add (new system.data.oledb.oledbParameter ("@ bookid", system.data.oledb.oledbtype.integer, 4));</p> <p>this.oleDbSelectCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "@ Accmonth", System.Data.OleDb.OleDbType.Integer, 4)); // // oleDbConnection1 // this.oleDbConnection1.ConnectionString = " User ID = sa; Data Source = ZH-SERVER; Password = 000; Initial Catalog = lishi_yongdian; Prov " " ider = SQLOLEDB.1 "; // // oleDbUpdateCommand1 // this.oleDbUpdateCommand1.CommandText =" [Web_GaugeDataUpdate] " ; this.oleDbUpdateCommand1.CommandType = System.Data.CommandType.StoredProcedure; this.oleDbUpdateCommand1.Connection = this.oleDbConnection1; this.oleDbUpdateCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "@ RETURN_VALUE", System.Data .Oledb.oledbtype.integer, 4, System.data.ParameterDirection.ReturnValue, False, ((System.byte) ((System.byte) (0)), "", System.Data.DatarowVersion. Current, NULL); this.oledbupdateCommand1.Parameters.Add (new system.data.oledb.oledbParameter ("@ gaugeid", system.data.oledb.oledbtype.integer, 4, "gaugeid"); this.oledbupda teCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "@ NewFread", System.Data.OleDb.OleDbType.VarChar, 6, "NewFread")); this.oleDbUpdateCommand1.Parameters.Add (new System.Data .OleDb.OleDbParameter ( "@ NewTread", System.Data.OleDb.OleDbType.VarChar, 6, "NewTread")); this.oleDbUpdateCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "@ NewGread", System.Data.OleDb.OleDbType.VarChar, 6, "NewGread")); this.oleDbUpdateCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "@ Accmonth", System.Data.OleDb.OleDbType.Integer, 4, "</p> <p>Accmonth ")); this.load = new system.eventhandler (this.page_load);} #ENDREGION</p> <p>Private void uptable_click (object sender, system.eventargs e) {this.Updata_table ();</p> <p>Private void updatabase_click (object sender, system.eventargs e) {this.Updata_table (); this.Update_database ();}</p> <p>Private void CANCLE_CLICK (Object Sender, System.EventArgs E) {this.cache.remove ("lion");}}}</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-20744.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="20744" 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.059</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 = 'btRmUthBd6Q0BBv5jgzFm1z_2FbeiIDXUcveNxnZucbHHF7prSJRdODASaGqDfsjvEsjPo7mm1Xofsorh1F5Oy6A_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>