[CLOSED] Ext.net.DirectMethods.XXXX

Page 2 of 2 FirstFirst 12
  1. #11
    Your .cs Class must extend System.Web.UI.Page.
    Geoffrey McGill
    Founder
  2. #12
    Here's a full sample using your code with the required corrections:

    Example (.aspx)

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StaticTest.aspx.cs" Inherits="Crystal.Views.Support.StaticTest" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Test</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server">
                <Listeners>
                    <DocumentReady Handler="App.direct.TestDirectEvent('55');" />
                </Listeners>
            </ext:ResourceManager>
    
            <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
                <Items>
                    <ext:Panel ID="Panel1" runat="server" Region="North" Height="70">
                        <Content>
                            <h3>Test</h3>
                        </Content>
                    </ext:Panel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    Example (.cs)

    using Ext.Net;
    
    namespace Crystal.Views.Support
    {
        public partial class StaticTest : System.Web.UI.Page
        {
            [DirectMethod()]
            public void TestDirectEvent(string id)
            {
                X.Msg.Notify("id", id).Show();
                //Console.Write("TEST");
            }
        }
    }
    Hope this helps.
    Geoffrey McGill
    Founder
  3. #13
    ok. i actually have a base class of BasePageView which extends from System.Web.Mvc.ViewPage

    I removed it for the example. As an MVC version of ext, i cant extend from System.Web.UI.Page since it would destroy my base class hierarchy.

    why doesnt it work with System.Web.Mvc.ViewPage?? I updated my sample to correct the base class

    Thanks,
    /Z
  4. #14
    why doesnt it work with System.Web.Mvc.ViewPage??
    I'm not really sure, but it doesn't really matter, because if you're using MVC then you should call a Controller, not a server-side Method directly.

    Another option is setting the .Url property with the path to the Controller.
    Geoffrey McGill
    Founder
  5. #15
    As I remember DirectMethods defined on .aspx ViewPage are working with Ext.NET v1. Though, it was something that we didn't support intentionally and it stopped working since v2. Having DirectMethods on a View in MVC is sort of a hacky design. I found the same problem has been discussed regarding Ext.NET v2.
    http://forums.ext.net/showthread.php...ll=1#post93347

    We recommend to move DirectMethods to a Controller. In this case a Controller class should be marked with an [DirectController] attribute to get DirectMethod proxies rendered to client.
  6. #16
    We will move it to the controller. This was the first page we built years back and haven't touched it since. No other pages have direct events. As we complete the upgrade to v3, we are trying to minimize scope as we have many files in our project.

    I try to do upgrade only and fixes after (for scope minimization). This one will need to be fixed as part of the upgrade apparently :)

    Thxs
    /Z
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 8
    Last Post: Aug 15, 2014, 4:34 AM
  2. T4MVC and DirectMethods
    By aptido in forum 2.x Help
    Replies: 0
    Last Post: Jun 13, 2013, 7:18 AM
  3. App / DirectMethods Objects gone?
    By Bubu in forum 1.x Help
    Replies: 2
    Last Post: Oct 31, 2012, 12:31 AM
  4. DirectMethods Problem
    By aelen in forum 1.x Help
    Replies: 3
    Last Post: Dec 26, 2011, 5:34 AM
  5. [CLOSED] [1.0] MVC Ext.net.DirectMethods
    By alliedwallet.com in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 19, 2011, 10:31 PM

Posting Permissions