我的代码很好用。问题是当我将Data-table应用于结果时结果显示更改的顺序。但是,当我删除数据表时,结果正确排序
<div class="box-body no-padding">
<div>
<table id="example2" class="table table-hover table-striped">
<thead>
<tr>
<% if (Request.QueryString["P"].ToString() == "S")
{ %>
<th>To</th>
<%} else {%>
<th>From</th>
<%} %>
<th></th>
<th>Date</th>
</tr>
</thead>
<tbody>
<%if (DtInbox.Rows.Count > 0)
{
for (int i = 0; i < DtInbox.Rows.Count; i++)
{
%>
<tr>
<%string x = DtInbox.Rows[i]["Mb_Idno"].ToString(); %>
<%if (DtInbox.Rows[i]["AStatus"].ToString() == "New")
{%>
<td class="mailbox-name">
<a href="Mailbox-read.aspx?Id=<%=DtInbox.Rows[i][4]%>&P=<%=Request.QueryString[" P "]%>">
<b><%=DtInbox.Rows[i]["SD_StudentName"]%></b></a>
</td>
<%}
else
{
%>
<td class="mailbox-name">
<a href="Mailbox-read.aspx?Id=<%=DtInbox.Rows[i][4]%>&P=<%=Request.QueryString[" P "]%>">
<span style="font-weight: 500"><%=DtInbox.Rows[i]["SD_StudentName"]%></span></a>
</td>
<%
}
%>
<td class="mailbox-subject"><b><%=DtInbox.Rows[i]["Subject"]%></b> -
<span style="font-style: italic"><%=DtInbox.Rows[i]["Message"]%></span>...</td>
<td class="mailbox-date" style="padding-right: 20px; font-weight: 400">
<%=Convert.ToDateTime(DtInbox.Rows[i]["Date"]).ToString("dd-MMM-yyyy")%>
</td>
</tr>
<%}
} %>
</tbody>
</table>
<!-- /.table -->
</div>
<!-- /.mail-box-messages -->
</div>
这是我的查询
select SD_StudentName,substring(Subject,0,40) as Subject,substring(Message,0,50) as Message,Date,Mb_IdNo,OLM_Mailbox.SD_IdNo,Ad_Id,AStatus
from OLM_Mailbox inner join OS_StudentDetails on OLM_Mailbox.SD_IdNo=OS_StudentDetails.SD_IdNo
where Ad_Id=1 and (AStatus='New' or AStatus='Viewed') order by Date desc , Mb_Idno desc
我到达 DtInbox 的结果是正确的顺序。但是当它适用于** jquery数据表**时,结果的顺序发生了变化。请帮我 我的Jquery只包含
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.jsdelivr.net/json2/0.1/json2.js"></script>
<script type="text/javascript">
$(function () {
$("#example2").DataTable();
});
</script>