One. Fineui (MVC) date format problem:
Fineui the value of the date control from view to control passes the problem (the pass-through code in view is "Txtdate1:f.ui.datepicker1.getvalue ()," but the format obtained in control is not a standard ' yyyy-mm -DD ' format Thu June 00:00:00 gmt+0800
This string with time zone cannot be converted to a date format by using substring () to take the previous part of the time zone. Convert to a date format in the format I want to convert my conversion mode such as: Convert.todatetime (txtdate2.substring (0, 24)). ToString ("Yyyy-mm-dd");
Two. Fineui (MVC) Multi-tab Common query criteria, Query button Export button resolution.
Because the content of the page is more, the table header form is different, so in the page layout and common parts do a lot of attempts, now write a more stupid method, all the page view code and control all put a view page and Controller page so the code complex system is indeed a lot of complexity. But here I try to have a switch statement that simplifies the code and logic.
A. On view: F.ui.tabstrip1.getactivetabindex () Gets the tab index of the current activity; Locate the corresponding grid ID in the active tab and then make the resulting grid the parameters of the query and export button
The specific code is as follows:
Alert ("1");
Grid table Header
var grid_fields;
var grid_fields2;
Gets the ID of the grid
var grid;
var Grid2;
Get active tab
var active = F.ui.tabstrip1.getactivetabindex () + 1;
var active2 = F.ui.tabstrip2.getactivetabindex () + 3;
Switch (Active)
{
Case 1:
Grid_fields = F.ui.grid1.fields;
Grid = F.UI.GRID1;
Break
Case 2:
Grid_fields = F.ui.grid2.fields;
Grid = F.ui.grid2;
Break
Default
Break
}
Switch (ACTIVE2)
{
Case 3:
GRID_FIELDS2 = F.ui.grid3.fields;
Grid2 = F.UI.GRID3;
Break
Case 4:
GRID_FIELDS2 = F.ui.grid4.fields;
Grid2 = F.ui.grid4;
Break
Case 5:
GRID_FIELDS2 = F.ui.grid5.fields;
Grid2 = F.UI.GRID5;
Break
Case 6:
GRID_FIELDS2 = F.ui.grid6.fields;
Grid2 = F.ui.grid6;
Break
Default
Break
}
Triggering background events
F.dopostback (' @Url. Action ("Grid_rebindgrid") ', {
Fields:grid_fields,
FIELDS2:GRID_FIELDS2,
Index1:active,
Index2:active2,
PageIndex:grid.pageIndex,
Pagesize:f.ui.ddlpagesize2.getvalue (),
Txtsite:f.ui.ddl_site.getvalue (),
Txtdate1:f.ui.datepicker1.getvalue (),
Txtdate2:f.ui.datepicker2.getvalue ()
})
b The method of control page assigns an initial value to the grid in each tab when it is initialized:
String sp_name1 = "P_ma_sasad_list";
String sp_name2 = "P_ma_sassg_list";
String sp_name3 = "P_ma_sassm_list";
String sp_name4 = "P_ma_sassc_list";
String sp_name5 = "P_ma_sasss_list";
String sp_name6 = "P_ma_sasad_list";
Bindddl_list ();
string[] param = new STRING[3];
Param[0] = "S10";
PARAM[1] = "2017-06-01";
PARAM[2] = "2017-12-01";
BINDGRID1 (sp_name1, param);
Bindgrid (sp_name2, param);
Bindgrid (Sp_name3, param);
Bindgrid (sp_name4, param);
Bindgrid (Sp_name5, param);
Bindgrid (Sp_name6, param);
Since the value method cannot be found, I take it and make it into a method
private void Bindgrid (String sp_name, string[] param)
{
Table header
int ipageindex = 1;
int ipagesize = 20;
String wherestr = "1=1";
Table content
DataTable Dthead = Querycommontst.getqueryresult (sp_name, "column", Ipageindex, Ipagesize, Wherestr, param);
DataTable dt = Querycommontst.getqueryresult (sp_name, "list", Ipageindex, Ipagesize, Wherestr, param);
Switch (sp_name)
{
Case "P_ma_sassg_list":
Table header
Viewbag.grid2columns = Gridcommon.gridheadcolumns (Dthead);
Table Records
Viewbag.grid2recordcount = Convert.ToInt32 (Querycommontst.getqueryresult (Sp_name, "Count", 1, 99999, WHERESTR, param) . Rows[0][0]);
Table content
Viewbag.grid2datasource = DT;
Break
Case "P_ma_sassm_list":
Table header
Viewbag.grid3columns = Gridcommon.gridheadcolumns (Dthead);
Table Records
Viewbag.grid3recordcount = Convert.ToInt32 (Querycommontst.getqueryresult (Sp_name, "Count", 1, 99999, WHERESTR, param) . Rows[0][0]);
Table content
Viewbag.grid3datasource = DT;
Break
Case "P_ma_sassc_list":
Table header
Viewbag.grid4columns = Gridcommon.gridheadcolumns (Dthead);
Table Records
Viewbag.grid4recordcount = Convert.ToInt32 (Querycommontst.getqueryresult (Sp_name, "Count", 1, 99999, WHERESTR, param) . Rows[0][0]);
Table content
Viewbag.grid4datasource = DT;
Break
Case "P_ma_sasss_list":
Table header
Viewbag.grid5columns = Gridcommon.gridheadcolumns (Dthead);
Table Records
Viewbag.grid5recordcount = Convert.ToInt32 (Querycommontst.getqueryresult (Sp_name, "Count", 1, 99999, WHERESTR, param) . Rows[0][0]);
Table content
Viewbag.grid5datasource = DT;
Break
Case "P_ma_sasad_list":
Table header
Viewbag.grid6columns = Gridcommon.gridheadcolumns (Dthead);
Table Records
Viewbag.grid6recordcount = Convert.ToInt32 (Querycommontst.getqueryresult (Sp_name, "Count", 1, 99999, WHERESTR, param) . Rows[0][0]);
Table content
Viewbag.grid6datasource = DT;
Break
Default
Break
}
}
#endregion Data Binding
Query data method is the same as the idea of initialization
#region Querying data
[HttpPost]
[Validateantiforgerytoken]
Public ActionResult Grid_rebindgrid (jarray fields, Jarray fields2, int index1, int index2, int pageIndex, int pageSize, St Ring Txtsite, String txtDate1, String txtDate2)
{
String sp_name = "";
String sp_name2 = "";
Fineuimvc.gridajaxhelper Grid;
Fineuimvc.gridajaxhelper Grid2;
Switch (INDEX1)
{
Case 1:
Grid = Uihelper.grid ("Grid1");
Sp_name = "P_ma_sassd_list";
break;
Case 2:
Grid = Uihelper.grid ("Grid2"),
Sp_name = "p_ma_sassg_list";
break;
Default:
Grid = Uihel Per. Grid ("Grid1");
Sp_name = "P_ma_sassd_list";
break;
}
Switch (index2)
{
Case 3:
Grid2 = Uihelper.grid ("Grid3");
Sp_name2 = "p_ma_sassm_list";
Bre Ak
Case 4:
Grid2 = Uihelper.grid ("Grid4"),
Sp_name2 = "p_ma_sassc_list";
Break,
Case 5:
Grid2 = Uihe Lper. Grid ("Grid5");
Sp_name2 = "P_ma_sasss_list";
break;
Case 6:
Grid2 = Uihelper.grid ("Grid6"),
Sp_name2 = "p_ma_sasad_list";
break;
Default:
Grid2 = Uih Elper. Grid ("Grid1");
Sp_name2 = "P_ma_sassd_list";
break;
}
string text = txtdate1.substring (1, 24);
String txtbegin = Convert.todatetime (txtdate1.substring (0,24)). ToString ("Yyyy-mm-dd");
String txtend = Convert.todatetime (txtdate2.substring (0, 24)). ToString ("Yyyy-mm-dd");
string[] Arykey = new String[3];
Arykey[0] = Txtsite;
ARYKEY[1] = Txtbegin;
ARYKEY[2] = txtend;
String wherestr = "1=1";
DataTable dt = Querycommontst.getqueryresult (sp_name, "list", PageIndex + 1, pageSize, Wherestr, Arykey);
DataTable DT2 = Querycommontst.getqueryresult (sp_name2, "list", PageIndex + 1, pageSize, Wherestr, Arykey);
Table Records
int count1 = Convert.ToInt32 (Querycommontst.getqueryresult (Sp_name, "Count", 1, 99999, Wherestr, Arykey). Rows[0][0]);
int count2 = Convert.ToInt32 (Querycommontst.getqueryresult (sp_name2, "Count", 1, 99999, Wherestr, Arykey). Rows[0][0]);
1. Set total number of items (if the total number of records does not change when the database is paged back, you can not set RecordCount)
Grid. RecordCount (COUNT1);
Grid2. RecordCount (Count2);
2. Set the number of items to display per page (to set pagesize when the number of records per page changes)
Grid. PageSize (PageSize);
Grid2. PageSize (PageSize);
Grid. DataSource (dt, fields);
Grid2. DataSource (DT2, FIELDS2);
return Uihelper.result ();
}
#endregion Querying data
}
C # Fineui notes in multi-page sign (tab)