我拥有几个县的投票控制。 它使用<代码>Ajax.BeginForm实施,该编码有一个隐蔽的领域,名称为vote 类型Hidden
。 每次被点击表决国,都会改变TypeHidden的投票价值,以更新正在投什么票。 该表格提交给服务器,并报告使用<代码>的任何错误。 现在,我想利用我的 j印功能显示这一错误。
ModalDialog(button, text, fadeOut)
如何做到这一点? www.un.org/Depts/DGACM/index_spanish.htm 文本参数转至ModalDialog功能非常重要,是观点。
此前,没有必要,但我也公布了我使用的守则。
The javascript:
<script type = "text/javascript">
var voteClickEnabled = true;
function voteClicked_Set(value) {
var voteType = value;
document.getElementById("voteTypeHidden").setAttribute("value", value);
}
function voteBegin() {
//alert("begin");
if (voteClickEnabled == false) {
return false;
}
else {
voteClickEnabled = false;
return true;
}
}
function voteEnd() {
//alert("end");
voteClickEnabled = true;
}
</script>
这里的观点是:
<div id = "updateVotes">
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Favorite :
<%=Html.Encode(ViewData["FavoriteCount"]) %>
<%//if(((int)ViewData["VoteBits"] & 1) == 0)
{%>
<% using (Ajax.BeginForm("Voting", "Vote", new {voted = ViewData["voted"], favorited = ViewData["favorited"], markedspam = ViewData["markedspam"], VotingOnId = (long)ViewData["VotingOnId"], VoteOn = (int)ViewData["VoteOn"], num_votes = 0, num_favorite = (int?)ViewData["FavoriteCount"], sdg = (int?)ViewData["sdg"], category = (int?)ViewData["category"] }, new AjaxOptions { UpdateTargetId = "updateVotes", OnBegin = "voteBegin", OnComplete = "voteEnd" }))
{%>
<%=Html.Hidden("voteTypeHidden", "temp", new { id = "voteTypeHidden" })%>
<%if ((bool)ViewData["voted"] == false)
{ %>
<%=Html.SubmitImage("voteButton", Url.Content("/Images/thumb_up.png"), new {value = "1", onclick = "voteClicked_Set(this.value)" })%>
<%}
else
{ %>
<%=Html.SubmitImage("voteButton", Url.Content("/Images/cancel.png"), new { value = "2", onclick = "voteClicked_Set(this.value)" })%>
<%} %>
<%if ((bool)ViewData["favorited"] == false)
{ %>
<%=Html.SubmitImage("voteButton", Url.Content("/Images/star_off_32.png"), new { value = "3", onclick = "voteClicked_Set(this.value)" })%>
<%}
else
{ %>
<%=Html.SubmitImage("voteButton", Url.Content("/Images/star_32.png"), new { value = "4", onclick = "voteClicked_Set(this.value)" })%>
<%} %>
<%if ((bool)ViewData["markedspam"] == false)
{ %>
<%=Html.SubmitImage("voteButton", Url.Content("/Images/error.png"), new { value = "5", onclick = "voteClicked_Set(this.value)" })%>
<%}
else
{ %>
<%=Html.SubmitImage("voteButton", Url.Content("/Images/error_go.png"), new { value = "6", onclick = "voteClicked_Set(this.value)" })%>
<%} %>
<%}%>
<%}%>
<div id = "testingAjax">
</div>
<% if (!string.IsNullOrEmpty((string)ViewData["VoteError"])) { %>
<script type = "text/javascript">
ModalDialog("testingAjax", "asd", false);
</script>
<%} %>
</div>