建一个工程,在该工程里加页面Parent.aspx与a.aspx。在Parent.aspx页面中加:
<table><tr><td><a href="javascript:window.showModalDialog('a.aspx','newwin','dialogHeight: 800px; dialogWidth: 600px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;');">模式窗体</a></td></tr></table>在a.aspx页面中对DataGird进行数据库的操作(修改,删除,添加记录)
出现错误。为方便您实验,提供该页绑顶DataGrid的部分代码如下[要修改,可运行]: private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
initDataGrid();
}
private void initDataGrid()
{
SqlConnection con=new SqlConnection ("Password=xxxx;Persist Security Info=True;User ID=sa;Initial Catalog=NorthWind;Data Source=xxxx");
con.Open ();
string strSQL="select * from Employees";
SqlCommand cmd=new SqlCommand (strSQL,con);
SqlDataReader dr=cmd.ExecuteReader();
DataGrid1.DataSource =dr;
DataGrid1.DataBind ();
}

解决方案 »

  1.   

    showModalDialog是模式窗口,要求的窗口类型,能这样操作吗?
      

  2.   

    <table><tr><td><a href="javascript:window.showModalDialog('a.aspx','newwin','dialogHeight: 800px; dialogWidth: 600px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;');">模式窗体</a></td></tr></table>这个试了,没问题呀!
    到底是什莫问题?
      

  3.   

    可以操作,有两点注意:
    1.不要使用缓存如果可以的话:
    <META http-equiv="Pragma" content="no-cache">
    <META http-equiv="Cache-Control" content="no-cache">
    <META http-equiv="Expires" content="0">
    2.要放入操作为_self,这样写:
    <base target="_self">以上都放入<head>中
      

  4.   

    在PAGE_LOAD 中加入
            Dim objNewTag As System.Web.UI.LiteralControl
            objNewTag = New LiteralControl("<base target=""_self"">")
            Me.Head.Controls.Add(objNewTag)        Response.Expires = 0