62,271
社区成员
发帖
与我相关
我的任务
分享 弹出层1编辑频道模板页面
<div id="EditModal" class="modal col-md-6 col-md-offset-3" style="background: #fff; margin-top: 30px; margin-bottom: 50px;" tabindex="-1" role="dialog" aria-labelledby="EditModalLabel" aria-hidden="true">
<div class="modal-header" style="padding: 0px;">
<button type="button" class="close" data-dismiss="modal">×</button>
<h5 id="EditModalLabel">修改频道模板页面</h5>
</div>
<div class="modal-body">
<div class="form-group">
此处代码略
</div>
<div class="modal-footer">
<asp:Button ID="btn_EditChannelTemplatePage" runat="server" class="btn btn-primary" Text="提交" OnClick="btn_EditChannelTemplatePage_Click" />
<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
//////////////////////////////////////////////////////////////////////////
弹出层2增加频道模板页面
<div id="AddModal" class="modal col-md-6 col-md-offset-3" style="background: #fff; margin-top: 30px; margin-bottom: 50px;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header" style="padding: 0px;">
<button type="button" class="close" data-dismiss="modal">×</button>
<h5 id="myModalLabel">增加频道模版页面</h5>
</div>
<div class="modal-body">
<div class="form-group">
此处代码略
<div class="form-group">
<label>英文名称</label>
<asp:TextBox ID="templateenname" name="templateenname" runat="server" class="form-control"></asp:TextBox>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="btn_SaveChannelTemplatenPage" runat="server" class="btn btn-primary" Text="增加" OnClick="btn_SaveChannelTemplatenPage_Click"/>
<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
$('#AddChannelTemplatePage').click(function () {
$('#AddModal').modal('show');
document.getElementById("templatename").value = "";
document.getElementById("templateenname").value = "";
document.getElementById("templatenameaspx").value = "";
document.getElementById("templatenamehtml").value = "";
document.getElementById("templatepagesort").value = "";
});
//编辑频道模板页面
$('#EditChannelTemplatePage').click(function () {
$('#AddModal').modal('hide');
var $table = $('#table');
if ($table.bootstrapTable('getSelections', 1).length > 0) {
var pagejson = JSON.stringify($table.bootstrapTable('getSelections', 1));
var obj1 = eval(pagejson);
if (obj1.length > 1) {
$('#ErrorModal').modal('show');
}
else {
document.getElementById("getchanneltemplatelid").value = obj1[0].id;
document.getElementById("edittemplatename").value = obj1[0].name;
document.getElementById("edittemplateenname").value = obj1[0].enname;
document.getElementById("edittemplatenameaspx").value = obj1[0].aspxpage;
document.getElementById("edittemplatenamehtml").value = obj1[0].htmlpage;
document.getElementById("edittemplatepagesort").value = obj1[0].sortid;
$('#EditModal').modal('show');
}
}
});


$.post("addTemplate.ashx",
{name: ...., html: ......, order:.....}, 回调);这样的形式来提交你的 modal 上的几个字段,根据回调时的结果(成功?)再来决定是不是要刷新页面或者怎样,而不用 asp.net 页面post 回发方式来提交这几个字段。
这样,慢慢地,也很简单的方式,你的前端就敏捷了。