如题

解决方案 »

  1.   

    "<script language='javascript'>window.opener.location.reload();window.close();</script>"
      

  2.   

    在winform应用程序上我的做法是:
    在SON窗口中增加一public MainForm main;
    主窗口中有一public 方法用来重新绑定datagrid
    比如:public void dataload()
    {
    //your code here to bind data
    }
    在主窗口打开子窗口时如下:
    son  sonFrm=new son();
    sonFrm.main=this;
    sonFrm.Show();
    在关闭子窗口前:
    main.dataload();
    Close();
      

  3.   

    子窗口是用showdialog打开的吗,如果是的话,直接在其后进行刷新父窗口即可,例如:frmSubForm.ShowDialog();
    //Refresh your datagrid here.
      

  4.   

    给子窗体绑定的数据源要和父窗口中datagrid绑定的数据源一致
      

  5.   

    lovevsnet(编程一把手) 用你的方法出现了如下错误:
    有关调用实时(JIT)调试而不是此对话框的详细信息,
    请参阅此消息的结尾。************** 异常文本 **************
    System.ArgumentException: 列“主机”不属于表 Table。
       at System.Data.DataRow.CheckColumn(DataColumn column)
       at System.Data.DataRow.get_Item(DataColumn column, DataRowVersion version)
       at System.Data.DataRowView.GetColumnValue(DataColumn column)
       at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
       at System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager source, Int32 rowNum)
       at System.Windows.Forms.DataGridTextBoxColumn.Edit(CurrencyManager source, Int32 rowNum, Rectangle bounds, Boolean readOnly, String instantText, Boolean cellIsVisible)
       at System.Windows.Forms.DataGrid.Edit(String instantText)
       at System.Windows.Forms.DataGrid.Edit()
       at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
       at System.Windows.Forms.Control.NotifyEnter()
       at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
    ************** 已加载的程序集 **************
    mscorlib
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
    ----------------------------------------
    manage
        程序集版本: 1.0.2307.16510
        Win32 版本: 1.0.2307.16510
        基本代码: file:///E:/Documents%20and%20Settings/Administrator/My%20Documents/Visual%20Studio%20Projects/manage/bin/Debug/manage.exe
    ----------------------------------------
    System.Windows.Forms
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
    ----------------------------------------
    System
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
    ----------------------------------------
    System.Drawing
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
    ----------------------------------------
    System.Data
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
    ----------------------------------------
    System.EnterpriseServices
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.enterpriseservices/1.0.5000.0__b03f5f7f11d50a3a/system.enterpriseservices.dll
    ----------------------------------------
    System.Xml
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
    ----------------------------------------
    mscorlib.resources
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/mscorlib.resources/1.0.5000.0_zh-chs_b77a5c561934e089/mscorlib.resources.dll
    ----------------------------------------
    System.Windows.Forms.resources
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.windows.forms.resources/1.0.5000.0_zh-chs_b77a5c561934e089/system.windows.forms.resources.dll
    ----------------------------------------
    System.Data.resources
        程序集版本: 1.0.5000.0
        Win32 版本: 1.1.4322.573
        基本代码: file:///e:/windows/assembly/gac/system.data.resources/1.0.5000.0_zh-chs_b77a5c561934e089/system.data.resources.dll
    ----------------------------------------************** JIT 调试 **************
    计算机的配置文件(machine.config)的 
     system.windows.forms 节中必须设置 jitDebugging 值。
    编译应用程序时还必须启用\r\n调试。\r\n\r\n例如: \r\n\r\n<configuration>\r\n    <system.windows.forms jitDebugging="true" />\r\n</configuration>\r\n\r\n启用 JIT 调试后,任何未处理的异常\r\n都将被发送到此计算机上注册的 JIT 调试器,\r\n而不是由此对话框处理。\r\n
      

  6.   

    子窗口是用showdialog打开的吗,如果是的话,直接在其后进行刷新父窗口即可,例如:frmSubForm.ShowDialog();
    //Refresh your datagrid here.
    -------------------------------------------
    good idea! 3Q.
      

  7.   

    把父窗体DataGrid作为参数传过去;
      

  8.   

    frmSubForm.ShowDialog();
    //Refresh your datagrid here.必须是用showdialog。这样程序会在showdialog的地方“暂停”,直到showdialog返回。
      

  9.   

    你的代码不要在SON的OCLOSED或CLOSING中执行
    在按钮的CLICK事件中执行应该可以,我是那么做的
    因为在SON没有DISPOSED时它的变量main是可以操作的
    如果你在SON中的修改不一定提交,那么在子窗口中用与主窗口相同的数据源试试
      

  10.   

    Response.Write("<script>window.opener.parent.location.href='YonghuGuanli.aspx';</script>");YonghuGuanli.aspx 窗体
      

  11.   

    我在写库存管理程序时用到,没问题,部份代码如下:
    inventory inv=new inventory();
    inv.evFrm=this;//evFrm就是你指的主窗口,inv是子窗口
    inv.Show();
    ------------------------------------------------------
    inv窗口对数据提交时就更新主窗口evFrm
    private void sav_inv_Click(object sender, System.EventArgs e)
    {
    //update data in inv,代码太长不好一次发就不COPY了
    if(evFrm!=null)
    evFrm.evLoad();
    }
      

  12.   

    直接
    dataset.clear
    tableadapter.fill那个datagrid所用的数据源也可以吧?