【问题标题】:How to dynamically create Ext.Net store to bind ComboBox?如何动态创建 Ext.Net 商店以绑定 ComboBox?
【发布时间】:2012-03-31 09:59:28
【问题描述】:

我正在使用Ext.Net 1.3 和 ASP.NET 4.0 应用程序。

我有几个使用 AJAX 查询填充的 Ext ComboBox 控件。由于项目是动态填充的,我想知道如何创建一个动态存储来绑定 ComboBox。

【问题讨论】:

    标签: asp.net ext.net


    【解决方案1】:

    您可以创建一个新的 Store 对象并添加到页面控件集合中。以下示例演示了一个简单的场景。

    示例

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                // Create a new Store object
                var store = new Store { 
                    // Configure your Properties
                };
    
                // Add Store to the Page. 
                this.Form.Controls.Add(store);
            }
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
    <form runat="server">
        <ext:ResourceManager runat="server" />
    
    </form>
    </body>
    </html>
    

    希望这会有所帮助。

    【讨论】:

    • 我可以看到这个商店将在运行时创建。我也想知道如何在运行时填充这个商店。
    • Ext.NET 示例资源管理器 (examples.ext.net) 中有几十个 GridPanel + Store 示例。它们都演示了如何填充商店。我建议研究其中的一些示例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    相关资源
    最近更新 更多