Visual studio 2008 dataTable.net服务器端处理:似乎未刷新
对于我的同事和我正在工作的站点,我们使用了www.dataTables.net中的dataTable格式,并且由于表的增长量,我们必须使用服务器端处理。以下是观点:Visual studio 2008 dataTable.net服务器端处理:似乎未刷新,visual-studio-2008,asp.net-mvc-2,server-side,datatables,Visual Studio 2008,Asp.net Mvc 2,Server Side,Datatables,对于我的同事和我正在工作的站点,我们使用了www.dataTables.net中的dataTable格式,并且由于表的增长量,我们必须使用服务器端处理。以下是观点: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <script type="text/javascript" charset="utf-8"> $(document).ready(function() {
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#adminUnassignedTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Admin/UpdateUnassignedReviewer",
"sPaginationType": "full_numbers"
});
});
</script>
<h2>Unassigned IPBs</h2>
<%
using (Html.BeginForm("Assign","Admin",FormMethod.Post))
{
Html.RenderPartial("AssignmentControls", "Reviewer");
%>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="adminUnassignedTable">
<thead><tr>
<th>IPB Number</th>
<th>IPB Pub Date</th>
<th>Change Number</th>
<th>Change Date</th>
<th>Total # of Parts</th>
<th>Total # of Report Parts</th>
<th>ALC</th>
<th>Date Loaded</th>
<th>Priority</th>
<th>Update</th>
</tr></thread>
<tbody><tr><td colspan="12" class="dataTable_empty">Loading Data From Server</td></tr></tbody>
</table>
<%
}
%>
下面是AdminView函数
public ActionResult(int? statusID, int? locationID)
{
if (!System.Web.HttpContext.Current.User.IsInRole("Admin"))
{
return RedirectToAction("Index", "Home");
}
PTA.Modesl.DataFactory factory = new DataFactory();
if(statusID == null)
{
statusID = (int)PTA.Helpers.Constants.State.Queue;
ViewData["status"] = statusID;
}
if(locationID == null)
{
locationID = (int)PTA.Helpers.Constants.Location.Reviewer;
ViewData["location"] = locationID;
}
TempData["pageStatus"] = statusID;
TempData["pageLocation"] = locationID;
TempData["Area"] = Request.QueryString["Area"]?? "Unassigned";
return View();
}
另外,请注意,我的dev机器与我的网络机器不同。所以我不能复制和粘贴,我也不能使用拇指驱动器。因此,我必须手动键入所有内容。所以,如果你看到一些拼写错误,只要问我,我会让你知道它是否正确。另外,您可能会要求查看两个操作,我之所以没有键入它们,是因为键入其他所有操作所需的时间。行动和分配。如果你想/需要看他们,请告诉我。谢谢。哈哈。答案是使用最新版本。当我应该使用1.7.0时,我正在使用1.6.7。它现在可以正常工作。StringBuilder可能是你的一些代码隐藏代码的朋友,哈哈。我知道它不漂亮。我和我的同事在不同的时间接触过这一切。我是一个坚持格式的人,只要有可能,我就是一个“一行”的人。只要行不超过500个字符。我滥用了他妈的三元陈述。他们向我解释了这一点,因为他们希望有尽可能多的断点。呸。
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Assign(string PriorityDropDown, string UserDropDown, string ActionDropDown)
{
ResetTempData(ref statusID, ref locationID, ref area);
int ipb_id = 0,
action = -1;
action = Request.Form["ActionDropDown"].ToString() == null || Request.Form["ActionDropDown"].ToString() == "" ? -1 : Convert.ToInt32(Request.Form["ActionDropDown"]);
string strUser = "",
strPriority = "";
strUser = Request.Form["UserDropDown"];
strPriority = Request.Form["PriorityDropDown"];
string[] strTemp = Request.Form.AllKeys;
foreach(string str in strTemp)
{
if(str.Contains("AssignCheck"))
{
ipb_id = Convert.ToInt32(Request.Form[str]);
if(action > -1 || (strUser != null || strUser != "") || (strPriority != null || strPriority != ""))
{
switch (action)
{
case -1:
Update(ipb_id, strPriority, strUser);
break;
case 1:
case 2:
case 5:
case 8:
Action(ipb_id, action);
break;
default: break;
}
}
}
}
return RedirectToAction("AdminView");
}
public ActionResult(int? statusID, int? locationID)
{
if (!System.Web.HttpContext.Current.User.IsInRole("Admin"))
{
return RedirectToAction("Index", "Home");
}
PTA.Modesl.DataFactory factory = new DataFactory();
if(statusID == null)
{
statusID = (int)PTA.Helpers.Constants.State.Queue;
ViewData["status"] = statusID;
}
if(locationID == null)
{
locationID = (int)PTA.Helpers.Constants.Location.Reviewer;
ViewData["location"] = locationID;
}
TempData["pageStatus"] = statusID;
TempData["pageLocation"] = locationID;
TempData["Area"] = Request.QueryString["Area"]?? "Unassigned";
return View();
}