[CLOSED] ResourceManager in Static DirectMethod

  1. #1

    [CLOSED] ResourceManager in Static DirectMethod

    Howdy,

    Is it possible to access resource manager in a static directmethod?

    I am trying to use X.ResourceManager or X.Redirect, but neither work.

    THANKS
    Last edited by Daniil; Dec 07, 2012 at 6:47 AM. Reason: [CLOSED]
  2. #2
    Hello!

    I don't quite understand why do you want to use X.ResourceManager, but if you want to use X.Redirect you can look at the following example:

    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void ButtonClick(object sender, DirectEventArgs e)
        {
            X.Mask.Show(new MaskConfig());
            X.Redirect("Default.aspx");
        }
    </script>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" SourceFormatting="True" />
        
        <ext:Button runat="server" Text="Some button">
            <DirectEvents>
                <Click OnEvent="ButtonClick"></Click>
            </DirectEvents>
        </ext:Button>
    </body>
    </html>
  3. #3
    Hi, Buddy!

    First of all, thanks for the quick answer. :)

    Make problem is in the STATIC direct method.

    I updated your code to reproduce my doubt.

    THANKS

    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        [DirectMethod]
        public static void ButtonClick()
        {
            X.Mask.Show(new MaskConfig());
            X.Redirect("Default.aspx");
        }
    </script>
     
    <!DOCTYPE html>
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" SourceFormatting="True" />     
        <ext:Button ID="Button1" runat="server" Text="Some button" OnClientClick="#{DirectMethods}.ButtonClick();" />
    </body>
    </html>
  4. #4
    Hi,

    A static DirectMethod cannot access any page controls including a ResourceManager (the same as it is for common ASP.NET PageMethods).

    A note about this fact is here, see #4:
    https://examples2.ext.net/#/Events/D...hods/Overview/

    A ResourceManager control is used in the Redirect method to resolve the passed URL.

    You can use this code in Ext.NET v1:
    X.Js.AddScript("window.location = '/Default.aspx';");
    In Ext.NET v2 the Redirect method works well in a static DirectMethod.
  5. #5
    Yes, I understand that the lifecycle isnt executed. I just didnt understand why the X.Redirect whouldn't work, since X.Js.Add worked.

    Thanks.

    Please, mark as closed.
  6. #6
    Since I cant do X.Redirect, I tried with window.location. But with this, FormsAuthentication.SetAuthCookie and FormsAuthentication.SignOut(); wont work. (Both worked with X.Redirect. I suspect that X.Redirect doenst do a window.location.href redirect)

    With Response.Redirect it works, but no addicional script is sent to client:

    X.Js.AddScript("Ext.net.Mask.show()");
    HttpContext.Current.Response.Redirect
    Any ideas?

    Thanks
    Last edited by geoffrey.mcgill; Nov 26, 2012 at 5:16 AM. Reason: please use [CODE] tags
  7. #7
    Quote Originally Posted by SouthDeveloper View Post
    I suspect that X.Redirect doenst do a window.location.href redirect
    X.Redirect does set window.location.

    Quote Originally Posted by SouthDeveloper View Post
    With Response.Redirect it works, but no addicional script is sent to client:
    X.Js.AddScript("Ext.net.Mask.show()");
    HttpContext.Current.Response.Redirect
    Response.Redirect uses 302 response for redirection. I don't think scripts in a response are possible in this case.

    Any sample to reproduce the problem with the SetAuthCookie and SignOut methods would be appreciated. For the both cases: where it works with X.Redirect and where it doesn't work when you set up "window.location" yourself.
  8. #8
    Will do. Will make and post.

Similar Threads

  1. [CLOSED] WebServices and ResourceManager
    By Justin_Wignall in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Jun 12, 2014, 5:15 AM
  2. Razor & ResourceManager
    By darrenarbell in forum 2.x Help
    Replies: 2
    Last Post: Apr 27, 2012, 7:40 PM
  3. ResourceManager and cause of Postback
    By Yemo in forum 1.x Help
    Replies: 1
    Last Post: Mar 17, 2011, 9:08 AM
  4. [CLOSED] Difference between DirectMethod , DirectEvent, Static DirectMethod
    By syllabusarq in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2011, 11:37 AM
  5. Problem with ResourceManager
    By jwcelyo in forum 1.x Help
    Replies: 2
    Last Post: Oct 27, 2010, 4:08 PM

Posting Permissions