DirectMethod in Custom Server Control

  1. #1

    DirectMethod in Custom Server Control

    Hello guys!

    I am creating a custom server control, in which I make a call to a DirectMethod, but I have not managed to find how to make the call. Apparently DirectMethod not recorded. Could you tell me which is the best way or the right way to do it?


    using System.Web.UI;
    using Ext.Net;
    using Microsoft.Build.Framework;
    
    /// <summary>
    /// DescripciĆ³n breve de ValidarPermisoSupervisor
    /// </summary>
    [ToolboxData("<{0}:ValidateAccess runat=server></{0}:ValidateAccess>")]
    [DirectMethodProxyID(IDMode = DirectMethodProxyIDMode.Alias, Alias = "ValidateAccess")]
    public class ValidateAccess : System.Web.UI.WebControls.WebControl
    {
        [Required]
        public string Application { get; set; }
    
        [Required]
        public string Operation { get; set; }
    
        protected override void OnInit(EventArgs e)
        {
            if (!ExtNet.IsAjaxRequest)
            {
                Page.X().Window().
                    ID(String.Format("win_{0}", ID)).
                    Resizable(False).
                    Icon(Icon.Lock).
                    Width(350).
                    Height(150).
                    Title("Login").
                    Layout("fit").
                    Border(False).
                    Modal(True).
                    ButtonAlign(Alignment.Right).
                    Items(i =>
                    {
                        i.Add(
                          Page.X().FormPanel().
                              Header(False).
                              Border(False).
                              Padding(5).
                              Items(f =>
                              {
                                  f.Add(
                                    Page.X().TextField().
                                        ID(String.Format("txtUserName_{0}", ID)).
                                        FieldLabel("User").
                                        AllowBlank(False).
                                        BlankText("Username").
                                        AnchorHorizontal("95%")
                                  );
    
    
    
                                  f.Add(
                                    Page.X().TextField().
                                        ID(String.Format("txtPassword_{0}", ID)).
                                        InputType(InputType.Password).
                                        FieldLabel("Password").
                                        AllowBlank(False).
                                        BlankText("Password").
                                        AnchorHorizontal("95%")
                                  );
    
    
                              })
                        );
                    }).
                    Buttons(b =>
                    {
                        var cmdAceptar = Page.X().Button().Text("Ok").Icon(Icon.Accept).ToComponent();
                        var cmdCancelar = Page.X().Button().Text("Cancel").Icon(Icon.Cancel).ToComponent();
    
                        //cmdAceptar.DirectEvents.Click.EventMask.ShowMask = True
                        //cmdAceptar.DirectEvents.Click.EventMask.Msg = "Validando credenciales..."
                        //AddHandler cmdAceptar.DirectEvents.Click.Event, Sub(s, a)
                        //                                                    ExtNet.Msg.Alert("validando", "Validando!").Show()
                        //                                                End Sub
    
                        cmdAceptar.Listeners.Click.Handler = "Ext.net.Mask.show({ msg : 'Loading data...' }); #{DirectMethods}.Validate();";
    
                        //ctl00_ContentPlaceHolderBody_WucMesaCambio1_validaPermisoSupervisorTCManual
                        //win_validaPermisoSupervisorTCManual
    
                        //cmdCancelar.Listeners.Click.Handler = String.Format("#{0}.hide();", String.Format("win_{0}", ID))
    
                        b.Add(cmdAceptar);
                        b.Add(cmdCancelar);
                    }).
                    Hidden(True).
                    ToComponent().
                    AddTo(Me);
            }
            base.OnInit(e);
        }
    
        [DirectMethod()]
        public void Validate()
        {
            X.Mask.Hide();
            X.Msg.Alert("test", "Test").Show();
        }
    }
    (I had to translate the code from VB to C# in the air, so if there is a typo error,please apologize)

    Thanks for all!!!
  2. #2
    Any help? :(

Similar Threads

  1. [CLOSED] AjaxMethod in Custom Server Control
    By jon in forum 1.x Premium Help
    Replies: 3
    Last Post: Aug 30, 2016, 2:18 PM
  2. [CLOSED] width of custom server control
    By Hlodvig in forum 2.x Premium Help
    Replies: 8
    Last Post: Nov 28, 2013, 7:19 AM
  3. Custom Server Control Textfield
    By m_bo in forum 1.x Help
    Replies: 3
    Last Post: Mar 30, 2012, 9:21 AM
  4. [CLOSED] Creating custom control on server side
    By AnulekhaK in forum 1.x Premium Help
    Replies: 11
    Last Post: Feb 21, 2012, 10:15 AM
  5. Replies: 8
    Last Post: Jun 28, 2010, 6:29 PM

Tags for this Thread

Posting Permissions