积极答复者
弹出窗体刷新父页面的问题???

问题
-
如果在父页面:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"
ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
<asp:ButtonField ButtonType="Button" CommandName="updateName" Text="修改设备名称" HeaderText="选择" />
</Columns>
</asp:GridView>
代码:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "updateName")
{
int index = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex;
string productId = GridView1.DataKeys[index].Value.ToString();
System.Web.UI.ScriptManager.RegisterStartupScript(this, Page.GetType(), "ajaxjs", "window.showModalDialog('a.aspx?productid=" + productId +"');", true);
}
}
弹出一个窗体
则关闭这个弹出窗体后如何刷新父页面?????
学习,学习,再学习..........- 已编辑 ysyy 2009年10月11日 8:13 写错
答案
-
您好,简单的刷新,请参考粗体:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "updateName")
{
int index = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex;
string productId = GridView1.DataKeys[index].Value.ToString();
System.Web.UI.ScriptManager.RegisterStartupScript(this, Page.GetType(), "ajaxjs", "window.showModalDialog('a.aspx?productid=" + productId +"'); self.location.href='"+ this.Request.Path +"'", true);
}
}
另,window.showModalDialog方法是有返回值的,如果有需要可以判断一下。- 已标记为答案 ysyy 2009年10月12日 2:38
全部回复
-
您好,简单的刷新,请参考粗体:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "updateName")
{
int index = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex;
string productId = GridView1.DataKeys[index].Value.ToString();
System.Web.UI.ScriptManager.RegisterStartupScript(this, Page.GetType(), "ajaxjs", "window.showModalDialog('a.aspx?productid=" + productId +"'); self.location.href='"+ this.Request.Path +"'", true);
}
}
另,window.showModalDialog方法是有返回值的,如果有需要可以判断一下。- 已标记为答案 ysyy 2009年10月12日 2:38
-
您好,我看到您在另一个贴中已问过了,X.X.Y不是已回复您了吗?
见http://social.microsoft.com/Forums/zh-CN/267/thread/46926fce-d4ff-48dc-89e0-9b75fd887ad8