In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to use easyui datagrid to receive and transmit parameters, in view of this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Rows is the number of rows passed from the client, and page is the page number. You only need two parameters to pass parameters. In the sql statement, _ row and _ page are local variables declared by themselves, and the values are still the corresponding row and page, just for calculation.
Use the database class to get its DataTable, convert it to json format and transfer it to the client through a general processor, and the client will display ok. Here I use easyui datagrid to receive and transmit parameters. This is a general way of thinking.
String sql = "select top" + rows + "* from TestData where testID not in (select top" + (_ rows * (_ page-1)) + "testID from TestData order by testID desc) order by testID desc"
/ / DataTable is converted into json. The total number of data passed to the client is "total". Without this, the client will not show the total number of data. Public static string CreateJsonParameters (DataTable dt, bool displayCount, int totalcount) {StringBuilder JsonString = new StringBuilder (); / / Exception Handling if (dt! = null) {JsonString.Append ("{"); if (displayCount) {JsonString.Append ("\" total\ ":"); JsonString.Append (totalcount); JsonString.Append (",") } JsonString.Append ("\" rows\ ": ["); for (int I = 0; I < dt.Rows.Count; iTunes +) {JsonString.Append ("{"); for (int j = 0; j < dt.Columns.Count) If +) {if (j < dt.Columns.Count-1) {/ / if (dt.Rows [I] [j] = = DBNull.Value) continue If (dt.Columns.dataType = = typeof (bool)) {JsonString.Append ("\"+ dt.ColumnName [j] .ColumnName +": "+ dt.Rows [I] [j] .ToString () .ToString () +", ") } else if (dt.Columns [j] .dataType = = typeof (string)) {JsonString.Append ("\"+ dt.ColumnName [j] .ColumnName +": "+"\ "" + dt.Rows [I] [j] .ToString (). Replace ("\", "\") + "\", ") } else {JsonString.Append ("\"+ dt.ColumnName [j] .ColumnName +": "+"\ "" + dt.Rows [I] [j] + "\", ") }} else if (j = = dt.Columns.Count-1) {/ / if (dt.Rows [I] [j] = = DBNull.Value) continue If (dt.Columns [j] .dataType = = typeof (bool)) {JsonString.Append ("\"+ dt.ColumnName [j] .ColumnName +": "+ dt.Rows [I] [j] .ToString ()) } else if (dt.Columns [j] .dataType = = typeof (string)) {JsonString.Append ("\"+ dt.ColumnName [j] .ColumnName +": "+"\ "" + dt.Rows [I] [j] .ToString (). Replace ("\", "\") + "\") } else {JsonString.Append ("\"+ dt.ColumnName [j] .ColumnName +": "+"\ "" + dt.Rows [I] [j] + "\") } / * end Of String*/ if (I = = dt.Rows.Count-1) {JsonString.Append ("}");} else {JsonString.Append ("},");}} JsonString.Append ("]") JsonString.Append ("}"); return JsonString.ToString (). Replace ("\ n", ");} else {return null }} this is the answer to the question about how to use easyui datagrid to receive and transmit parameters. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.