【问题标题】:Add new Window from C# Code-Behind in ext.net从 ext.net 中的 C# Code-Behind 添加新窗口
【发布时间】:2016-03-29 17:55:33
【问题描述】:

我想在代码隐藏中添加一个新的Window 和工作ListenersDirectEvents,以在Button-Click 上实现管理界面。到目前为止,我有以下代码(最小化):

Window editwindow = new Window(){
   ID="Window_Edit",
   width = 380,
   height = 120,
   hidden = false
};
FormPanel editpanel = new FormPanel(){
   ID="Panel_Edit"
}; 
editpanel.Items.Add(new TextField(){
   ID="Edit_Fieldname",
   FieldLabel = "Some Label",
   LabelStyle="text-align:right;",
   Width = 260,
   LabelWidth=120
});
editwindow.Add(editpanel);
this.Page.Controls.Add(editwindow);
//Viewport.Add(editwindow); Viewport is a wrapping <ext:Container>
//editwindow.DoLayout(); this has been throwing a reference error on client-side

我想知道如何使窗口显示出来。现在,如果我使用 firebug 检查执行,则在 Post 请求中返回状态代码 200: OK。但在此之前我做了一些 Store 操作,响应中不包含这些 Store Changes!

现在有趣的是,更改触发按钮的文本可以正常工作,所以我确信没有执行完全重新加载。

【问题讨论】:

    标签: c# dynamic ext.net


    【解决方案1】:

    我对我的回复做出了一些假设,因为您尚未发布演示整个场景的示例,但我认为修改以下内容应该可行:

    // Old
    // editwindow.Add(editpanel);
    // this.Page.Controls.Add(editwindow);
    
    // New
    editwindow.Items.Add(editpanel);
    editwindow.Render(this.Form);
    

    以下示例还演示了在 DirectEvent 期间动态创建 Window 并添加 的场景,请参阅

    http://examples.ext.net/#/XRender/Basic/New_Window/

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-10-30
      • 1970-01-01
      • 1970-01-01
      • 2013-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多