Panel()

1.使用Content和Html属性设置Panel内容

前台View代码

@(X.Panel()
        .ID("panel1")
        .Width()
        .Height()
        .Title("Html")
        .BodyPadding()
        .Content(c=>DateTime.Now.ToString())
        .Buttons(
            X.Button()
            .Text("使用Content属性")
            .DirectEvents(de =>
            {
                de.Click.Url = Url.Action("SetHtmlProperty");
                de.Click.ExtraParams.Add(new Parameter("containerId", "panel1"));
            })
        )
    )

按钮Click事件后台代码

public ActionResult SetHtmlProperty(string containerId)
{
    this.GetCmp<Panel>(containerId).Html = DateTime.Now.ToString();
    return this.Direct();
}

2.使用Loader的Html模式从服务器获取Panel内容

View中的代码

@(X.Panel()
    .ID("panel2")
    .Width()
    .Height()
    .Title("Loader with Html mode")
    .BodyPadding()
    .Loader(
        X.ComponentLoader()
        .Url(Url.Action("RenderChild"))
        .Mode(LoadMode.Html)
        .LoadMask(lm=>lm.ShowMask = true)
    )
    .Buttons(
        X.Button()
        .Text("SetLoaderProperty")
        .DirectEvents(de =>
        {
            de.Click.Url = Url.Action("SetLoaderProperty");
            de.Click.Method = HttpMethod.GET;
            de.Click.ExtraParams.Add(new Parameter("containerId", "panel2"));
        }),
        X.Button()
        .Text("LoadHtmlContent")
        .DirectEvents(de =>
        {
            de.Click.Url = Url.Action("LoadHtmlContent");
            de.Click.ExtraParams.Add(new Parameter("containerId", "panel2"));
        })
    )
)

后台Button事件

public ActionResult SetLoaderProperty(string containerId)
{
    var panel = this.GetCmp<Panel>(containerId);
    panel.Loader = new ComponentLoader
    {
        Url = Url.Action("RenderChild"),
        DisableCaching = true
    };
    panel.Loader.SuspendScripting();
    panel.LoadContent();

    return this.Direct();
}

public ActionResult LoadHtmlContent(string containerId)
{
    this.GetCmp<Panel>(containerId).LoadContent("RenderChild", true);
    return this.Direct();
}

3.使用Loader的Frame模式从服务器获取Panel内容

View中代码

@(X.Panel()
    .ID("panel3")
    .Width()
    .Height()
    .Title("Loader with Frame mode")
    .BodyPadding()
    .Loader(
        X.ComponentLoader()
        .Url(Url.Action("RenderChild"))
        .Mode(LoadMode.Frame)
        .LoadMask(lm=>lm.ShowMask = true)
    )
    .Buttons(
        X.Button()
        .Text("SetIFrameLoadProperty")
        .DirectEvents(de =>
        {
            de.Click.Url = Url.Action("SetIFrameLoadProperty");
            de.Click.Method = HttpMethod.GET;
            de.Click.ExtraParams.Add(new Parameter("containerId", "panel3"));
        }),
        X.Button()
            .Text("LoadIFrameContent")
            .DirectEvents(de =>
            {
                de.Click.Url = Url.Action("LoadIFrameContent");
                de.Click.ExtraParams.Add(new Parameter("containerId", "panel3"));
            })
    )
)

后台Button事件

public ActionResult SetIFrameLoadProperty(string containerId)
{
    Panel panel = this.GetCmp<Panel>(containerId);
    panel.Loader = new ComponentLoader
    {
        Url = Url.Action("RenderChild"),
        DisableCaching = true,
        Mode = LoadMode.Frame
    };
    panel.Loader.SuspendScripting();
    panel.LoadContent();
    return this.Direct();
}

public ActionResult LoadIFrameContent(string containerId)
{
    this.GetCmp<Panel>(containerId).LoadContent(new ComponentLoader
    {
        Url = Url.Action("RenderChild"),
        DisableCaching = true,
        Mode = LoadMode.Frame
    });
    return this.Direct();
}

Ext.Net 学习随笔 003 Panel基本使用的更多相关文章

  1. Ext.Net 学习随笔 003 超链接按钮

    HyperlinkButton() 1.不带图标的普通超链接按钮 @(X.HyperlinkButton() .Text("简单样式") .OnClientClick(" ...

  2. Ext.Net 学习随笔 001 安装Ext.Net

    Ext.Net版本:4.1.0 Ext.Net官网:ext.net Ext.Net官方演示:mvc.ext.net Ext.Net MVC Example 下载:github.com/extnet/E ...

  3. Ext.Net 学习随笔 002 默认按钮

    在FormPanel中按回车按键,会触发默认按钮的click事件.设置方法为在FormPanel中设置DefaultButton属性,如果没有设置这个属性,默认为最后一个按钮. 1.缺省最后一个按钮为 ...

  4. 【Ext.Net学习笔记】04:Ext.Net中使用数据、Ext.Net Store的用法、Ext.Net ComboBox用法

    之前的几篇文章都是介绍Ext.Net较为基础的东西,今天的这一篇将介绍数据的一些用法,包括XTemplate绑定数据.Store(Modal.Proxy).ComboBox的用法等. XTemplat ...

  5. 【Ext.Net学习笔记】02:Ext.Net用法概览、Ext.Net MessageBus用法、Ext.Net布局

    Ext.Net用法概览 Ext.Net还是很强大,如果运用熟练可以极大的提高编程效率.如果你也要学习Ext.Net,原文博主推荐书籍:<Ext.Net Web 应用程序开发教程>,是英文的 ...

  6. Ext.Net学习笔记22:Ext.Net Tree 用法详解

    Ext.Net学习笔记22:Ext.Net Tree 用法详解 上面的图片是一个简单的树,使用Ext.Net来创建这样的树结构非常简单,代码如下: <ext:TreePanel runat=&q ...

  7. Ext.Net学习笔记23:Ext.Net TabPanel用法详解

    Ext.Net学习笔记23:Ext.Net TabPanel用法详解 上面的图片中给出了TabPanel的一个效果图,我们来看一下代码: <ext:TabPanel runat="se ...

  8. 【Ext.Net学习笔记】06:Ext.Net GridPanel的用法(GridPanel 折叠/展开行、GridPanel Selection、 可编辑的GridPanel)

    GridPanel 折叠/展开行 Ext.Net GridPanel的行支持折叠/展开功能,这个功能个人觉得还说很有用处的,尤其是数据中包含图片等内容的时候. 下面来看看效果: 使用行折叠/展开功能之 ...

  9. 【Ext.Net学习笔记】05:Ext.Net GridPanel的用法(包含Filter、Sorter、Grouping、汇总(Summary)的用法)

    GridPanel是用来显示数据的表格,与ASP.NET中的GridView类似. GridPanel用法 直接看代码: <ext:GridPanel runat="server&qu ...

随机推荐

  1. AsyncTask异步交互和httpurlconnection结合使用

    //网络请求数据 package com.baidu.myutils; import java.io.BufferedReader; import java.io.InputStreamReader; ...

  2. DotSpatial 创建面状要素——含空洞

    private void toolStripButton23_Click(object sender, EventArgs e) { //选择图层 FeatureSet fs = null; fs = ...

  3. EF实体框架数据操作基类(转)

    //----------------------------------------------------------------// Copyright (C) 2013 河南禄恒软件科技有限公司 ...

  4. 这种代码怎么改写?以致于在下次增加CustomsType时,不需要再加 if 语句。

    最近看到项目里一段代码如下: excelObject excel = new excelObject(); if (loadbill.CustomsType == 1) excel.IDownload ...

  5. css 中content内容特殊形状

    用到的一些特殊字符和图标html代码<div class="cross"></div>css代码.cross{    width: 20px;    hei ...

  6. Python的平凡之路(18)

    一.JS 正则部分 test   - 判断字符串是否符合规定的正则rep = /\d+/;rep.test("asdfoiklfasdf89asdfasdf")# truerep ...

  7. ARMLinux下Alignment trap的一些测试 【转自 李迟的专栏 CSDN http://blog.csdn.net/subfate/article/details/7847356

    项目中有时会遇到字节对齐的问题,英文为“Alignment trap”,如果直译,意思为“对齐陷阱”,不过这个说法不太好理解,还是直接用英文来表达. ARM平台下一般是4字节对齐,可以参考文后的给出的 ...

  8. .NET网页打印以及使用打印需要注意的事项(可能会引起VS崩溃的现象、打印预览后关闭功能不管用)

    这两天进行给网页添加打印.打印预览.页面设置的功能.遇到了以下几个问题 [1]在网上查找了一些打印方法,一开始还可以用,后来不知道动到了哪里,点击vs中拆分或者切换到另一个设计和源代码显示方式,就会引 ...

  9. iOS UITableViewCell滑动删除

    一般我们使用列表的形式展现数据就会用到UITableView.在熟练掌握了用UITableView展示数据以后,开发过程中可能会遇到需要删除数据的需求,我们想实现在一行数据上划动一下,然后出现一个删除 ...

  10. bookstore网上书店测试缺陷报告2

    Bookstore网上书店系统测试缺陷报告   缺陷编号 01.01.0002 发现人 吴赵昕 记录日期 2016-06-10 所属模块 购物车 确认人 吴赵昕 确认日期 2016-06-10 当前状 ...