[CLOSED] Error with DirectEventin LoginView

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Error with DirectEventin LoginView

    Hi,
    I'm trying to call a diriect method from a ext:button within a LoginView asp.net control but I get this error:

    "The control with ID 'DynamicContent_LoginView_ButtonValidateLogin' not found"

    I tried to change idMode to static but what I get is the error:

    "The control with ID 'ButtonValidateLogin' not found"

    I am using a MasterPage (wich contains the ResourceManager)

    Here is my code.


    <asp:Content ID="Home_Content" ContentPlaceHolderID="DynamicContent" runat="server">   
    
        
        <asp:LoginView ID="LoginView" runat="server">        
            <AnonymousTemplate> 
            <ext:Panel ID="PanelToAuthenticateMaster" StyleSpec="margin: 0px auto 0px auto;" runat="server" MonitorResize="true" Layout="FitLayout" Width="300" AutoHeight="true">
                <Items>
                    <ext:FormPanel ID="PanelToAuthenticate"                     
                        runat="server"                                     
                        Title="Autenticazione" 
                        MonitorValid="true"
                        Padding="5"
                        Frame="true"
                        LabelWidth="80"
                        Height="200">
                        <Items>
                            <ext:TextField 
                                ID="Username" 
                                runat="server" 
                                FieldLabel="Utente" 
                                AllowBlank="false"
                                BlankText="Utente richiesto."
                                Text="r.foldes"
                                />
                            <ext:TextField 
                                ID="Password" 
                                runat="server" 
                                InputType="Password" 
                                FieldLabel="Password" 
                                AllowBlank="false" 
                                BlankText="Password Richiesta."
                                Text="renobo-04">
                                <Listeners>
                                    <SpecialKey Fn="TH.Default.enterKeyPressHandler" />
                                    <KeyPress Fn="TH.Default.enterKeyPressHandler" />
                                </Listeners>
                            </ext:TextField>
                            <ext:HyperLink
                                id="ForgotPasswordHyperLink"
                                runat="server"
                                Text="Password Dimenticata?"
                                NavigateUrl="ForgotPassword.aspx" />
    
                            <ext:Checkbox
                                id="RememberMe"
                                runat="server"
                                FieldLabel="Ricordami" />
    
                        </Items>                    
                        <Buttons>
                            <ext:Button ID="ButtonValidateLogin" Icon="Lock" runat="server" Text="Entra">
                                <DirectEvents>
                                    <Click 
                                        OnEvent="Login1_Authenticate" 
                                        Method="POST" 
                                        
                                        Failure="
                                            #{Password}.setValue('');
                                            Ext.Msg.show({
                                               title:   'Errore di Autenticazione',
                                               msg:     result.errorMessage,
                                               buttons: Ext.Msg.OK,
                                               icon:    Ext.MessageBox.ERROR
                                            });
                                        ">
                                        <EventMask ShowMask="true" MinDelay="250" />
                                        <ExtraParams>
                                            <ext:Parameter Name="userName" Value="#{Username}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="password" Value="#{Password}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="rememberMe" Value="#{RememberMe}.getValue()" Mode="Raw" />
                                        </ExtraParams>
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                        </Buttons>
                        <Listeners>
                            <%--<ClientValidation Handler="ButtonValidateLogin.setDisabled(!valid);" />--%>
                        </Listeners>
                    </ext:FormPanel>
                </Items>
                <BottomBar>
                    <ext:StatusBar ID="FormStatusBar" runat="server" DefaultText="Pronto">
                        <Items>
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                            <ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server" />
                            <ext:ToolbarTextItem ID="clock" runat="server" Text=" " CtCls="x-status-text-panel" />
                        </Items>
                        <Plugins>
                            <ext:ValidationStatus ID="ValidationStatus1" 
                                runat="server" 
                                FormPanelID="PanelToAuthenticate" 
                                ValidIcon="Accept" 
                                ErrorIcon="Exclamation" 
                                ShowText="Ci sono degli errori (Clicca per i Dettagli)"
                                />
                        </Plugins>
                    </ext:StatusBar>
                </BottomBar>
                <Listeners>
                </Listeners>
            </ext:Panel>
    
            <ext:TaskManager ID="TaskManagerTime" runat="server">
                <Tasks>
                    <ext:Task AutoRun="true" Interval="1000">
                        <Listeners>
                            <Update Handler="#{clock}.setText(new Date().format('H:mm:ss'));" />
                        </Listeners>
                    </ext:Task>
                </Tasks>
            </ext:TaskManager>
            </AnonymousTemplate>
            <LoggedInTemplate>
    <%--            <uc1:Disclaimer ID="Disclaimer1" runat="server" />
                <nws:ucNews ID="ucNews" runat="server" />
    --%>        </LoggedInTemplate>
        </asp:LoginView>
    
        <br />
        <asp:LoginView ID="LoginView2" runat="server">
            <RoleGroups>
                <asp:RoleGroup Roles="Salesperson">
                    <ContentTemplate>
                    </ContentTemplate>
                </asp:RoleGroup>
                <asp:RoleGroup Roles="Customer">
                    <ContentTemplate>
                    </ContentTemplate>
                </asp:RoleGroup>
            </RoleGroups>
        </asp:LoginView> 
     
    </asp:Content>
    Last edited by Daniil; Apr 23, 2012 at 1:58 PM. Reason: [CLOSED]
  2. #2
    I could reproduce the error importing end editing the page form the example "Button with DirectEvent": (url: https://examples2.ext.net/#/Buttons/Basic/Overview/)

    I just put the Button inside a standard asp.net LoginView Template and i get the error:

    "The control with ID 'LoginView1_Button2' not found "

        <h2>2. Button with DirectEvent</h2>
        
        <asp:LoginView ID="LoginView1" runat="server">
        <AnonymousTemplate>
        <ext:Button ID="Button2" runat="server" Text="Click Me">
            <DirectEvents>
                <Click OnEvent="Button_Click">
                    <EventMask ShowMask="true" />
                    <ExtraParams>
                        <ext:Parameter Name="Item" Value="One" />
                    </ExtraParams>
                </Click>
            </DirectEvents>
        </ext:Button>
        </AnonymousTemplate>
        </asp:LoginView>
  3. #3
    Hi,

    I was unable to reproduce using the example below.

    Please provide your full example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("DirectEvent", e.ExtraParams["test"]).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>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <asp:LoginView runat="server">
                <AnonymousTemplate>
                    <ext:Button runat="server" Text="Click Me">
                        <DirectEvents>
                            <Click OnEvent="TestDirectEventHandler">
                                <EventMask ShowMask="true" />
                                <ExtraParams>
                                    <ext:Parameter Name="test" Value="Hello!" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </AnonymousTemplate>
            </asp:LoginView>
        </form>
    </body>
    </html>
  4. #4
    Hi Daniil,
    I added you example to my project and still get the error: "The control with ID 'ctl04_ctl01' not found "


    Maybe the problem is in some Web.Config setting?

    
    <%@ Page Language="C#"  %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 
    
    
    <script runat="server">    
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)    {        
            X.Msg.Alert("DirectEvent", e.ExtraParams["test"]).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>Ext.NET Example</title>
    </head>
    <body>
        <form  runat="server">
        <ext:ResourceManager runat="server" />
        <asp:LoginView runat="server">
            <AnonymousTemplate>
                <ext:Button runat="server" Text="Click Me">
                    <DirectEvents>
                        <Click OnEvent="TestDirectEventHandler">
                            <EventMask ShowMask="true" />
                            <ExtraParams>
                                <ext:Parameter Name="test" Value="Hello!" />
                            </ExtraParams>
                        </Click>
                    </DirectEvents>
                </ext:Button>
            </AnonymousTemplate>
        </asp:LoginView>
        </form>
    </body>
    </html>

    Web.Config

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <configSections>
        <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
      </configSections>
      <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
        <add name="SQL_ASPNET_ConnectionString" connectionString="Data Source=SRVCRM;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=sa;Password=xxx" providerName="System.Data.SqlClient" />
        <add name="SQL_SCAMBIO_ConnectionString" connectionString="Data Source=SRVCRM;Initial Catalog=Sauflon_Scambio;Persist Security Info=True;User ID=sa;Password=xxx" providerName="System.Data.SqlClient" />
      </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
          <authentication mode="Forms">
              <forms loginUrl="Default.aspx" protection="All" timeout="120" name="B2B_Reno" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseCookies" defaultUrl="Default.aspx" enableCrossAppRedirects="true" />
              <!-- defaultUrl="Default.aspx" -->
              <!-- loginUrl="Default.aspx" -->
          </authentication>
          <membership defaultProvider="NasMembershipProv">
              <providers>
                  <add connectionStringName="SQL_SCAMBIO_ConnectionString" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" writeExceptionsToEventLog="true" name="NasMembershipProv" type="renosistemi.it.NasMembershipProvider" />
              </providers>
          </membership>
          <roleManager defaultProvider="NasRoleProv" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
              <providers>
                  <clear />
                  <add name="NasRoleProv" type="renosistemi.it.NasRoleProvider" connectionStringName="SQL_SCAMBIO_ConnectionString" applicationName="/B2B_Reno" writeExceptionsToEventLog="true" />
              </providers>
          </roleManager>
          <profile enabled="true" defaultProvider="SqlProvider">
              <providers>
                  <clear />
                  <add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SQL_ASPNET_ConnectionString" applicationName="/B2B_Reno" description="SqlProfileProvider for SampleApplication" />
              </providers>
              <properties>
                  <add name="PKID" type="string" allowAnonymous="true" />
                  <add name="CustomerCode" type="string" allowAnonymous="true" />
                  <add name="CustomerName" type="string" allowAnonymous="true" />
                  <add name="SalespersonCode" type="string" allowAnonymous="true" />
                  <add name="FullName" type="string" allowAnonymous="true" />
                  <add name="LastLoginDate" type="datetime" allowAnonymous="true" />
                  <add name="DraftNo" type="string" allowAnonymous="true" />
                  <add name="LanguageCode" type="string" allowAnonymous="true" />
                  <add name="StyleSheetTheme" type="string" allowAnonymous="true" />
              </properties>
          </profile>
          <anonymousIdentification enabled="true" cookieName=".ASPXANONYMOUS" cookieTimeout="100000" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="Validation" cookieless="UseCookies" domain="" />
          <customErrors mode="Off" />
          <httpHandlers>
          <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
        </httpHandlers>
        <httpModules>
          <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </httpModules>
      </system.web>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true">
          <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </modules>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
          <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" />
        </handlers>
      </system.webServer>
      <extnet theme="Gray" licenseKey="xxx" />
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.8.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
        <appSettings>
            <add key="enableSimpleMembership" value="false"/>
            <add key="autoFormsAuthentication" value="false"/>
    
        </appSettings>
    </configuration>
  5. #5
    Hi marco, you have visible your licence key in the web.config.

    PS)Ciao hai lasciato il tuo numero di licenza visibile nel web.config, forse ti è sfuggito.
    Se questo non ti dovesse interessare ignora pure il post.
    Sei di bologna e io di brescia, magari ci si potrebbe scambiare qualche info, io è da poco che uso le ext.net
  6. #6
    I can assume that you somewhere logged in already and asp:LoginView doesn't create 'AnonymousTemplate' controls for ajax request
    Try to replace direct event by listener with direct method callling, in that direct method return status about current user (anonymous or registered), you can use X.Js.Alert to show that status. If user is registered then my assumption is correct
  7. #7
    Thank you Vladimir,
    I did not login; anyway I provide as attachment a simple file that causes the error (.rar renamed as .txt).

    The project uses Ext.NET 2.0.

    If you debug with ext.net source code you will find that the error is in the line emphasized below.

    Thanks in advance.
    Marco

            /// <summary>
            /// 
            /// </summary>
            /// <param name="eventArgument"></param>
            [Description("")]
            public void RaisePostBackEvent(string eventArgument)
            {
                this.postbackPerformed = true;
                
                if (eventArgument.IsEmpty())
                {
                    return;
                }
    
                string[] args = eventArgument.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                
                if (args.Length != 3)
                {
                    return;
                }
    
                string requestTypeArg = (args[1].Equals("postback")) ? "PostBack" : args[1].ToCamelCase();
    
                AjaxRequestType requestType = (AjaxRequestType)Enum.Parse(typeof(AjaxRequestType), requestTypeArg, true);
    
                string controlID = args[0];
                string controlEvent = args[2];
    
                if (!Enum.IsDefined(typeof(AjaxRequestType), requestType))
                {
                    throw new HttpException("Incorrect ajax request type - {0}".FormatWith(requestType));
                }
    
                Control ctrl = null;
    
                bool isCustomDirectEvent = requestType == AjaxRequestType.Custom;
                bool isDirectMethodCall = requestType == AjaxRequestType.Public;
    
                if (!isCustomDirectEvent)
                {
                    if (controlID == "-")
                    {
                        if (isDirectMethodCall)
                        {
                            ctrl = this.Page;
                        }
                        else
                        {
                            ctrl = this;
                        }
                    }
                    else
                    {
                        ctrl = ResourceManager.FindControlByConfigID(this.Page, controlID, true, null);
    
                        if (ctrl == null)
                        {
                            
    throw new HttpException("The control with ID '{0}' not found".FormatWith(controlID));
    } } } bool returnViewState = false; bool rethrowException = false; ParameterCollection extraParams = new ParameterCollection(); if (this.DirectConfig != null) { JToken viewStateMode = this.DirectConfig.SelectToken("config.viewStateMode", false); if (viewStateMode != null) { ViewStateMode mode = (ViewStateMode)Enum.Parse(typeof(ViewStateMode), JSON.ToString(viewStateMode), true); returnViewState = mode == Ext.Net.ViewStateMode.Enabled; } JToken rethrowExceptionToken = this.DirectConfig.SelectToken("config.rethrowException"); if (rethrowExceptionToken != null) { rethrowException = bool.Parse(JSON.ToString(rethrowExceptionToken)); } JToken userParamsToken = this.DirectConfig.SelectToken("config.extraParams"); if (userParamsToken != null) { extraParams = ResourceManager.JTokenToParams(userParamsToken); } } ResourceManager.ReturnViewState = returnViewState; Observable observable; switch (requestType) { case AjaxRequestType.Bus: observable = ctrl as Observable; if (observable == null) { throw new HttpException("The control with ID '{0}' is not Observable".FormatWith(controlID)); } if (observable != null) { observable.FireBusEvent(controlEvent, extraParams); } break; case AjaxRequestType.Event: observable = ctrl as Observable; if (observable == null) { if (ctrl is ResourceManager) { this.FireAsyncEvent(controlEvent, extraParams); } else { throw new HttpException("The control with ID '{0}' is not Observable".FormatWith(controlID)); } } if (observable != null) { observable.FireAsyncEvent(controlEvent, extraParams); } break; case AjaxRequestType.Custom: ResourceManager sm = this; foreach (DirectEvent directEvent in sm.CustomDirectEvents) { if (directEvent.EventID == controlEvent) { directEvent.OnEvent(new DirectEventArgs(extraParams)); break; } } break; case AjaxRequestType.PostBack: IAjaxPostBackEventHandler ajaxPostBackHandler = ctrl as IAjaxPostBackEventHandler; if (ajaxPostBackHandler != null) { ajaxPostBackHandler.RaiseAjaxPostBackEvent(controlEvent, extraParams); break; } IPostBackEventHandler postbackHandler = ctrl as IPostBackEventHandler; if (postbackHandler == null) { throw new HttpException("The control with ID '{0}' is not IPostBackEventHandler".FormatWith(controlID)); } postbackHandler.RaisePostBackEvent(controlEvent); break; case AjaxRequestType.Public: if (ctrl == null) { throw new HttpException("The control '{0}' of ajax instanse method not found".FormatWith(controlID)); } HttpContext context = HttpContext.Current; HandlerMethods handler = HandlerMethods.GetHandlerMethodsByType(context, ctrl.GetType(), ctrl.TemplateSourceDirectory, false); string methodName = controlEvent; if (handler == null) { throw new Exception("The handler '{0}' is absent!".FormatWith(context.Request.FilePath)); } if (methodName.IsEmpty()) { throw new Exception("The ajax method is not defined!"); } DirectMethod directMethod = handler.GetInstanceMethod(methodName); if (directMethod == null) { throw new Exception("The ajax instance method '{0}' is absent!".FormatWith(methodName)); } try { object result = directMethod.Invoke(ctrl, extraParams); DirectMethodResult = result; } catch (System.Reflection.TargetException) { ReInvokeDirectMethod(ctrl, extraParams, context, methodName); } catch (TargetInvocationException e) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = this.IsDebugging ? e.InnerException.ToString() : e.InnerException.Message; if (this.RethrowAjaxExceptions || rethrowException) { throw; } } catch (Exception e) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = this.IsDebugging ? e.ToString() : e.Message; if (this.RethrowAjaxExceptions || rethrowException) { throw; } } break; default: throw new ArgumentOutOfRangeException(requestType.ToString()); } }
    Attached Files
  8. #8
    Thank you Vladimir,
    I did not login; anyway I provide as attachment a simple file that causes the error (.rar renamed as .txt).

    The project uses Ext.NET 2.0 (Revision 3947).

    If you debug with ext.net source code you will find that the error is in the line emphasized below.

    Thanks in advance.
    Marco

            /// <summary>
            /// 
            /// </summary>
            /// <param name="eventArgument"></param>
            [Description("")]
            public void RaisePostBackEvent(string eventArgument)
            {
                this.postbackPerformed = true;
                
                if (eventArgument.IsEmpty())
                {
                    return;
                }
    
                string[] args = eventArgument.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                
                if (args.Length != 3)
                {
                    return;
                }
    
                string requestTypeArg = (args[1].Equals("postback")) ? "PostBack" : args[1].ToCamelCase();
    
                AjaxRequestType requestType = (AjaxRequestType)Enum.Parse(typeof(AjaxRequestType), requestTypeArg, true);
    
                string controlID = args[0];
                string controlEvent = args[2];
    
                if (!Enum.IsDefined(typeof(AjaxRequestType), requestType))
                {
                    throw new HttpException("Incorrect ajax request type - {0}".FormatWith(requestType));
                }
    
                Control ctrl = null;
    
                bool isCustomDirectEvent = requestType == AjaxRequestType.Custom;
                bool isDirectMethodCall = requestType == AjaxRequestType.Public;
    
                if (!isCustomDirectEvent)
                {
                    if (controlID == "-")
                    {
                        if (isDirectMethodCall)
                        {
                            ctrl = this.Page;
                        }
                        else
                        {
                            ctrl = this;
                        }
                    }
                    else
                    {
                        ctrl = ResourceManager.FindControlByConfigID(this.Page, controlID, true, null);
    
                        if (ctrl == null)
                        {
                            
    throw new HttpException("The control with ID '{0}' not found".FormatWith(controlID));
    } } } bool returnViewState = false; bool rethrowException = false; ParameterCollection extraParams = new ParameterCollection(); if (this.DirectConfig != null) { JToken viewStateMode = this.DirectConfig.SelectToken("config.viewStateMode", false); if (viewStateMode != null) { ViewStateMode mode = (ViewStateMode)Enum.Parse(typeof(ViewStateMode), JSON.ToString(viewStateMode), true); returnViewState = mode == Ext.Net.ViewStateMode.Enabled; } JToken rethrowExceptionToken = this.DirectConfig.SelectToken("config.rethrowException"); if (rethrowExceptionToken != null) { rethrowException = bool.Parse(JSON.ToString(rethrowExceptionToken)); } JToken userParamsToken = this.DirectConfig.SelectToken("config.extraParams"); if (userParamsToken != null) { extraParams = ResourceManager.JTokenToParams(userParamsToken); } } ResourceManager.ReturnViewState = returnViewState; Observable observable; switch (requestType) { case AjaxRequestType.Bus: observable = ctrl as Observable; if (observable == null) { throw new HttpException("The control with ID '{0}' is not Observable".FormatWith(controlID)); } if (observable != null) { observable.FireBusEvent(controlEvent, extraParams); } break; case AjaxRequestType.Event: observable = ctrl as Observable; if (observable == null) { if (ctrl is ResourceManager) { this.FireAsyncEvent(controlEvent, extraParams); } else { throw new HttpException("The control with ID '{0}' is not Observable".FormatWith(controlID)); } } if (observable != null) { observable.FireAsyncEvent(controlEvent, extraParams); } break; case AjaxRequestType.Custom: ResourceManager sm = this; foreach (DirectEvent directEvent in sm.CustomDirectEvents) { if (directEvent.EventID == controlEvent) { directEvent.OnEvent(new DirectEventArgs(extraParams)); break; } } break; case AjaxRequestType.PostBack: IAjaxPostBackEventHandler ajaxPostBackHandler = ctrl as IAjaxPostBackEventHandler; if (ajaxPostBackHandler != null) { ajaxPostBackHandler.RaiseAjaxPostBackEvent(controlEvent, extraParams); break; } IPostBackEventHandler postbackHandler = ctrl as IPostBackEventHandler; if (postbackHandler == null) { throw new HttpException("The control with ID '{0}' is not IPostBackEventHandler".FormatWith(controlID)); } postbackHandler.RaisePostBackEvent(controlEvent); break; case AjaxRequestType.Public: if (ctrl == null) { throw new HttpException("The control '{0}' of ajax instanse method not found".FormatWith(controlID)); } HttpContext context = HttpContext.Current; HandlerMethods handler = HandlerMethods.GetHandlerMethodsByType(context, ctrl.GetType(), ctrl.TemplateSourceDirectory, false); string methodName = controlEvent; if (handler == null) { throw new Exception("The handler '{0}' is absent!".FormatWith(context.Request.FilePath)); } if (methodName.IsEmpty()) { throw new Exception("The ajax method is not defined!"); } DirectMethod directMethod = handler.GetInstanceMethod(methodName); if (directMethod == null) { throw new Exception("The ajax instance method '{0}' is absent!".FormatWith(methodName)); } try { object result = directMethod.Invoke(ctrl, extraParams); DirectMethodResult = result; } catch (System.Reflection.TargetException) { ReInvokeDirectMethod(ctrl, extraParams, context, methodName); } catch (TargetInvocationException e) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = this.IsDebugging ? e.InnerException.ToString() : e.InnerException.Message; if (this.RethrowAjaxExceptions || rethrowException) { throw; } } catch (Exception e) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = this.IsDebugging ? e.ToString() : e.Message; if (this.RethrowAjaxExceptions || rethrowException) { throw; } } break; default: throw new ArgumentOutOfRangeException(requestType.ToString()); } }
  9. #9
    Quote Originally Posted by Daniil View Post
    Hi,

    I was unable to reproduce using the example below.

    Please provide your full example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("DirectEvent", e.ExtraParams["test"]).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>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <asp:LoginView runat="server">
                <AnonymousTemplate>
                    <ext:Button runat="server" Text="Click Me">
                        <DirectEvents>
                            <Click OnEvent="TestDirectEventHandler">
                                <EventMask ShowMask="true" />
                                <ExtraParams>
                                    <ext:Parameter Name="test" Value="Hello!" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </AnonymousTemplate>
            </asp:LoginView>
        </form>
    </body>
    </html>
    The problem is reproducible with Ext.NET v2. We will investigate.
  10. #10
    Please update from SVN
    http://svn.ext.net/premium/branches/2.0
    and re-test.

    Now the example I've posted works.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] LoginView with LinkButton
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 04, 2012, 11:16 AM
  2. [CLOSED] Button in a listview with a loginview
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Nov 18, 2011, 12:00 PM
  3. Replies: 17
    Last Post: Oct 12, 2011, 4:54 PM
  4. How to use LoginView with coolite
    By jidaneri in forum 1.x Help
    Replies: 2
    Last Post: Mar 11, 2010, 6:22 PM
  5. Replies: 2
    Last Post: Jul 29, 2009, 1:57 PM

Posting Permissions