Problem, with hash in direct method data

  1. #1

    Problem, with hash in direct method data

    Hello

    This code will cause direct method to fall
    the problem is with # character. Is there any way how to prevent this method to failing?

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Threading" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <ext:ResourceManager runat="server"></ext:ResourceManager>
            <script runat="server">
                [DirectMethod]
                public static string GetTimeStamp4()
                {
    
                    return "xxx #{0}";
                }
            </script>
    
            <ext:Button runat="server" Text="Click Me" Icon="Lightning">
                <Listeners>
                    <Click Handler="
                        App.direct.GetTimeStamp4({
                            success: function (result) {
                                Ext.Msg.alert('Server Time', result);
                            }
                        });" />
                </Listeners>
            </ext:Button>
    Last edited by fabricio.murta; Dec 27, 2019 at 7:49 PM.
  2. #2
    Hello @jirihost!

    The string you provide matches Ext.NET tokens. If you don't use this ${id} syntax at all, you can disable it with the following code in your global.asax file:

    TokenUtils.Settings.Disable = true;
    More about this available at: Post #19 in Place holder with a format #{parameter_name}

    If you don't want to disable token parsing across the whole application, you can just replace the # character into &epar; or any equivalent HTML expansion tag.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Ok thanks, that works

    TokenUtils.Settings.DisableDuringDirectEvent = true;
    In fact I wonder why to ever set it to false, as it means direct method woould return error

Similar Threads

  1. Replies: 3
    Last Post: Aug 03, 2015, 5:59 PM
  2. Replies: 2
    Last Post: Nov 08, 2013, 3:14 PM
  3. [CLOSED] Bind store data in direct method
    By bayoglu in forum 2.x Premium Help
    Replies: 2
    Last Post: Jun 14, 2013, 7:13 PM
  4. [CLOSED] Output Cache issue with Direct Method / Direct Event
    By amitpareek in forum 1.x Premium Help
    Replies: 18
    Last Post: Mar 01, 2013, 6:03 AM
  5. [CLOSED] 2.0/2.1 Direct method problem
    By gets_gui in forum 2.x Premium Help
    Replies: 15
    Last Post: Nov 13, 2012, 5:02 AM

Posting Permissions