這是我的ajax尋呼機代碼如下:現在我想確保當前頁面的鏈接是不可點擊的,CSS也應該反映。我的尋呼機正在跟蹤當前頁碼,所以這不是問題。我擔心的是,我應該如何讓這個特定的鏈接不可點擊,看起來不同(不寫一大堆瘋狂的if-else塊)?mvc - ajax尋呼機 - 使當前頁面無效鏈接
<%if(Model.num_pages > 1){ %>
<table>
<tr>
<td><%=Model.Total%></td>
<td><%=Ajax.ActionLink("1",
Model.originalAction,
Model.originalController,
new { Page = 1, totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId },
new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" })%></td>
<%if (Model.num_pages > 3)
{ %>
<td>
<%using (Ajax.BeginForm(
Model.originalAction,
Model.originalController,
new {totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId },
new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" }))
{%>
<%=Html.DropDownList("Page", Model.dropDown)%>
<input value = "jump" type = "submit" />
<%} %>
</td>
<%} %>
<%else
{
for (int i = 2; i < Model.num_pages; i++)
{%>
<td>
<%=Ajax.ActionLink(i.ToString(),
Model.originalAction,
Model.originalController,
new { Page = i, totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId},
new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" })%>
</td>
<% }
}%>
<td><%=Ajax.ActionLink(Model.num_pages.ToString(),
Model.originalAction,
Model.originalController,
new { Page = Model.num_pages, totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId},
new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" })%></td>
</tr>
</table>
<%} %>
我不認爲如果還有其他問題,坦率地說 – hunter 2010-11-10 19:26:28
你認爲我使用了太多的if-else?它不會只是一個更多,如果 - 其他......這將是其中的一小部分。如果你知道如何僅僅使用一個,那就讓我知道。 – TPR 2010-11-10 21:33:27