DirectMethodProxyID in .NET 3.5

  1. #1

    DirectMethodProxyID in .NET 3.5

    Hi!

    How I can use DirectMethodProxyID in .NET 3.5.

    I tried use it in my custom control like in this example:

    using Ext.Net;
    
    [DirectMethodProxyID(IDMode = DirectMethodProxyIDMode.Alias, Alias = "UC")]
    public partial class AliasID : System.Web.UI.UserControl
    {
        [DirectMethod]
        public void HelloUserControl()
        {
            X.Msg.Alert("Message", "Hello from UserControl").Show();
        }
    }
  2. #2

    RE: DirectMethodProxyID in .NET 3.5

    Hi,

    DirectMethod inside custom control doesn't support alias
    Please see the following example which demonstrates the direct method inside custom control
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">    
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Form.Controls.Add(new TestButton());
        }
        
        
        [DirectMethod(Namespace="TestNS")]
        public void TestM(int test)
        {
    
        }
    
        public class TestButton : Ext.Net.Button
        {
            public TestButton()
            {
                this.Text = "Test";
            }
    
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
                this.ResourceManager.AddDirectMethodControl(this);
                this.Handler = string.Format("function(){{ Ext.net.DirectMethods.{0}.ShowNotification();}}", this.ClientID);
            }
    
            [DirectMethod]
            public void ShowNotification()
            {
                Ext.Net.X.Msg.Notify("TestButton", "TestButton").Show();
            }        
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
           
        </form>
      </body>
    </html>

Similar Threads

  1. Replies: 7
    Last Post: Oct 20, 2011, 11:35 AM

Posting Permissions