PDA

View Full Version : [CLOSED] Error with DirectEventin LoginView



marco.morreale
Apr 19, 2012, 8:54 AM
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>

marco.morreale
Apr 19, 2012, 9:22 AM
I could reproduce the error importing end editing the page form the example "Button with DirectEvent": (url: http://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>

Daniil
Apr 19, 2012, 4:55 PM
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>

marco.morreale
Apr 20, 2012, 8:26 AM
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|\asp netdb.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>

Aurelio
Apr 20, 2012, 8:47 AM
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

Vladimir
Apr 20, 2012, 9:49 AM
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

marco.morreale
Apr 20, 2012, 12:44 PM
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(control Event, 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() );
}
}

marco.morreale
Apr 20, 2012, 12:45 PM
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(control Event, 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() );
}
}

Daniil
Apr 20, 2012, 4:16 PM
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.

Daniil
Apr 20, 2012, 6:46 PM
Please update from SVN
http://svn.ext.net/premium/branches/2.0
and re-test.

Now the example I've posted works.

marco.morreale
Apr 23, 2012, 1:04 PM
Please update from SVN
http://svn.ext.net/premium/branches/2.0
and re-test.

Now the example I've posted works.

With the latest version (SVN):

Ext.Net.dll 2.0.4496.21690
Ext.Net.Utilities.dll 2.0.0.38521

and with the project that I have attached, the error persists.

The code is Simple:



<%@ 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 id="Head1" runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<asp:LoginView ID="LoginView1" runat="server">

<LoggedInTemplate>
<ext:Button ID="Button1" runat="server" Text="Click Me">
<DirectEvents>
<Click OnEvent="TestDirectEventHandler">
<EventMask ShowMask="true" />
<ExtraParams>
<ext:Parameter Name="test" Value="Hello!" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</LoggedInTemplate>
</asp:LoginView>
</form>
</body>
</html>


Thanks.

Vladimir
Apr 23, 2012, 1:36 PM
Hi,

Please set DisableViewState="false" for ResourceManager

marco.morreale
Apr 23, 2012, 1:53 PM
Thanks,
now works properly.

Only to understand, in version 1.2 and 1.3 Viestate was normally the disabled?
I do not remember ever having set the viewstate in previous versions.
What has changed?

Vladimir
Apr 23, 2012, 1:55 PM
Ext.Net 2 removes ViewState from a page by default
Ext.Net 1.x doesn't remove ViewState from a page rendering by default

marco.morreale
Apr 23, 2012, 2:07 PM
Thanks.

Form me it is CLOSED.