showModalDialog  出来的窗口怎么在Page_Load绑定DBGrid在打开第二次数据不更新和第一次的数据库一样,绑定代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
    string Str_Build="select * from MenuTree where Depth='1'";
DataBinder(Str_Build);
}
private void DataBinder(string SQLText)
{
Dg_ChooseMenu.DataSource = FunClass.SelectToDataSet(SQLText);
Dg_ChooseMenu.DataBind();
}
        //获取查询的数据集
public DataSet SelectToDataSet(string SQLText)
{
ConClass.Open();
SqlCommand Cmd_Select = new SqlCommand(SQLText,ConClass.ADOCon);
SqlDataAdapter Dadp_Select = new SqlDataAdapter();
Dadp_Select.SelectCommand = Cmd_Select;
DataSet DataSet_Return = new DataSet();
try
{
Dadp_Select.Fill(DataSet_Return);
}
catch
{
return null;
}
finally
{
ConClass.Close();
}
return DataSet_Return;
}

解决方案 »

  1.   

    在page_load事件中写入下面的语句
    Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    试试。
    不知有没有理解错你的问题意思:)
      

  2.   

    我是用: RetObj = window.showModalDialog("FrmChooseMenu.aspx",window,"dialogHeight:400px;dialogWidth:320px;center:Yes;Help:No;Resizable:No;Status:Yes;Scroll:auto;Status:no;");打开FrmChooseMenu.aspx页面的,打第一次打开时:
    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
        string Str_Build="select * from MenuTree where Depth='1'";
    DataBinder(Str_Build);
    }执行了 page_load 事件,但在打开这个页面时:page_load就没有执行怎么回事
      

  3.   

    哈哈,你的 // 在此处放置用户代码以初始化页面
        string Str_Build="select * from MenuTree where Depth='1'";
    DataBinder(Str_Build);
    这串语句最好放在if (!IsPostback)里面
      

  4.   

    加了:Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    可以了,但我没有看明白这句话的意思
      

  5.   

    哦,就是IsPostBack的问题嘛?private void Page_Load(object sender, System.EventArgs e)
    {
    if(!IsPostBack){
    string Str_Build="select * from MenuTree where Depth='1'";
    DataBinder(Str_Build);}
    }