情况是这样的:我的后台页面框架是用bootstrap开发的 下面的代码是两个弹出层。
两个按扭分别控制新增和编辑在下面的JS代码中。
在新增和编辑的页面都有保存的按钮,
分别是btn_EditChannelTemplatePage 编辑
btn_SaveChannelTemplatenPage增加
现在问题来。当我把增加弹出层放在编辑弹出层的下面时。
编辑弹出层的保存按钮在后台直接执行新增的方法。
而当我把编辑层放在新增层的代码下面时后台直接执行编辑的方法,就是说把哪个层的代码放在下面就执行哪个层的的保存按钮方法。完全不按套路出牌。
我估计是z-index的问题。因为当中保留其中一个层时都没有问题。
但是我也不知道要改哪里。有大神帮帮我吧。
弹出层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>JS代码
$('#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'); }
}
});现在点编辑的保存按钮直接变成了新增!
两个按扭分别控制新增和编辑在下面的JS代码中。
在新增和编辑的页面都有保存的按钮,
分别是btn_EditChannelTemplatePage 编辑
btn_SaveChannelTemplatenPage增加
现在问题来。当我把增加弹出层放在编辑弹出层的下面时。
编辑弹出层的保存按钮在后台直接执行新增的方法。
而当我把编辑层放在新增层的代码下面时后台直接执行编辑的方法,就是说把哪个层的代码放在下面就执行哪个层的的保存按钮方法。完全不按套路出牌。
我估计是z-index的问题。因为当中保留其中一个层时都没有问题。
但是我也不知道要改哪里。有大神帮帮我吧。
弹出层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>JS代码
$('#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'); }
}
});现在点编辑的保存按钮直接变成了新增!
解决方案 »
- js脚本调用前台函数的奇怪问题
- 怎样用ajax判断用户是否存在
- 如何download服务器上的Excel文件
- 请问cache可以随着浏览器关闭失效吗?
- 急!!!设计界面看不到控件,只能看到表格,但运行起来就可以看见,原代码也可以看见代码.以前瞒好的不知道为什么突然这样了,
- 如何解析一个域名对应的IP是什么?
- 用asp.net来对SQL server的数据库实现INSERT,该怎么操作?
- 一个.net交流的QQ群:7941071,欢迎高手进来:)
- asp.net 发布后,前台验证失效
- 哪位有做过动态创建表格的,填完一行数据,再生成一行!!!
- 您好 我正在自学ASP.NET 安装了VS2015和SQL2014 但我目前不知道如何连接数据库 看了教材上的介绍都是各种代码 没有具体的操作步骤 ;例如在
- chrome浏览器菜单栏兼容性问题
{name: ...., html: ......, order:.....}, 回调);这样的形式来提交你的 modal 上的几个字段,根据回调时的结果(成功?)再来决定是不是要刷新页面或者怎样,而不用 asp.net 页面post 回发方式来提交这几个字段。这样,慢慢地,也很简单的方式,你的前端就敏捷了。
我也正在想ajax方式处理算了。可能是懒,ajax要写很多证验,要多写很多代码,呵呵。直接用asp.net触发的话可以少做很多工作。
这个项目以前有后台代码的。现在只是把前端全部改了。我可以直接COPY过来。这样快很多。如果写成AJAX的话我要多写很多代码。