在GridView中添加了一个打开showModalDialog的按钮,点击弹出一个模态框,当我关闭的时候,总是去刷新父页面,请高人帮忙分析分析为什么?我本不想去刷新父页面,不知道是哪里处理上有问题,可能是AJAX的问题,请教高人部分代码如下:<%@ Page Language="C#" MasterPageFile="~/oem.master" AutoEventWireup="true" CodeFile="MyOverView.aspx.cs"
Inherits="SMPPersonalManage_MyOverView" EnableEventValidation="false" Title="Untitled Page" %><%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<script language="javascript" type="text/javascript">
function approveFlow()
{
var smpBillId = '0dff97dc-e69b-4030-a312-cd2e4d99334b';
var value = window.showModalDialog('ApproveFlowView.aspx?smpBillId='+smpBillId,'','dialogWidth=500px;dialogHeight=200px;status:no;scroll:no');
return false;
}
</script><asp:TemplateField HeaderText="Approval flow">
<ItemStyle Font-Size="9pt" BorderWidth="1px" HorizontalAlign="Center" />
<HeaderStyle BorderWidth="1px" Font-Size="9pt" HorizontalAlign="Center" />
<ItemTemplate>
<input type="image" id="imageView" runat="server" src="../SMPimages/view.png" />
<%-- <asp:ImageButton ID="ibtnView" runat="server" ImageUrl="~/SMPimages/view.png" OnClientClick="approveFlow()" />--%>
</ItemTemplate>
</asp:TemplateField>
Inherits="SMPPersonalManage_MyOverView" EnableEventValidation="false" Title="Untitled Page" %><%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<script language="javascript" type="text/javascript">
function approveFlow()
{
var smpBillId = '0dff97dc-e69b-4030-a312-cd2e4d99334b';
var value = window.showModalDialog('ApproveFlowView.aspx?smpBillId='+smpBillId,'','dialogWidth=500px;dialogHeight=200px;status:no;scroll:no');
return false;
}
</script><asp:TemplateField HeaderText="Approval flow">
<ItemStyle Font-Size="9pt" BorderWidth="1px" HorizontalAlign="Center" />
<HeaderStyle BorderWidth="1px" Font-Size="9pt" HorizontalAlign="Center" />
<ItemTemplate>
<input type="image" id="imageView" runat="server" src="../SMPimages/view.png" />
<%-- <asp:ImageButton ID="ibtnView" runat="server" ImageUrl="~/SMPimages/view.png" OnClientClick="approveFlow()" />--%>
</ItemTemplate>
</asp:TemplateField>
解决方案 »
- 最近写了个小型cms.来问个自定义字段的问题.现在的数据插入速度有点慢。
- 求解:gridView绑定数据时,如何根据修改行颜色
- 请教关于ASP.net做网页问题
- 问个比较俗的问题
- RoleProvider.IsUserInRoles()方法得问题
- 关于OpenFileDialog的ShowDialog(),请教.
- ASP.NET Session 丢失问题???????????????????
- 單擊DataGrid中的某一行即自動鏈接到與該行相關的網頁中而不響應服務器事件,怎麼做?
- 访问关系数据库的多种好方法!欢迎各位数据库应用的朋友们来作客!
- Table与ViewState
- 一个分组的SQL语句怎么写?
- 未将对象引用设置到对象的实例(附代码)
<ItemStyle Font-Size="9pt" BorderWidth="1px" HorizontalAlign="Center" />
<HeaderStyle BorderWidth="1px" Font-Size="9pt" HorizontalAlign="Center" />
<ItemTemplate>
<input type="image" id="imageView" runat="server" src="../SMPimages/view.png" onclick="approveFlow()" />
</ItemTemplate>
</asp:TemplateField>
OnClientClick="return approveFlow()"
是你表单提交才会刷新页面
input干嘛不换成img
因为approveFlow()返回的是false,在客户端的时候要return approveFlow()(也就是false)
要return approveFlow()才有效果的
你把 <input type="image" id="imageView" runat="server" src="../SMPimages/view.png" onclick="approveFlow()" />换成<img src="../SMPimages/view.png" onclick="approveFlow()" style="cursor:pointer"/>试下