PDA

View Full Version : [FIXED] [V0.6] All Controls with AjaxEvents fail



Timothy
Sep 14, 2008, 3:23 PM
Hello,

From the latest SVN the following issue is happening:

Example.aspx:


<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Control control = Page.LoadControl("Example-Control.ascx");

UserControl.Controls.Add(control);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<p><a href="Example.aspx">Reload</a></p>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" Theme="Gray" />
<asp:PlaceHolder ID="UserControl" runat="server" />
</form>
</body>
</html>


Example-Control.ascx


<%@ Control Language="C#" ClassName="Example_Control" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{

}
protected void txtTest_Change(object sender, AjaxEventArgs e)
{

}
protected void drpAccountType_Change(object sender, AjaxEventArgs e)
{

}
</script>
<ext:TextField ID="txtTest" runat="server">
<AjaxEvents>
<Change OnEvent="txtTest_Change" />
</AjaxEvents>
</ext:TextField>
<ext:ComboBox ID="drpAccountType" runat="server" Editable="False" ForceSelection="True" Mode="Local" Select&#111;nfocus="True" TypeAhead="True" Width="255">
<AjaxEvents>
<Change OnEvent="drpAccountType_Change" />
</AjaxEvents>
<SelectedItem Text="Customer" Value="Customer" />
<Items>
<ext:ListItem Text="Customer" Value="Customer" />
<ext:ListItem Text="Employee" Value="Employee" />
</Items>
</ext:ComboBox>


Replication steps:

1. Load page
2. Type into text field, lose focus
3. Notice the error message that returns

4. Reload page
5. Select from combo, lose focus
6. Notice the error message that returns

Cheers,
Timothy

Timothy
Sep 14, 2008, 3:36 PM
Fails in ScriptManager.cs:



if (!isCustomAjaxEvent)
{
if(controlID == "-")
{
ctrl = this;
}
else
{
ctrl = ControlUtils.FindControl(this, controlID, true);

if (ctrl == null)
{
throw new HttpException(string.Format("The control with ID '{0}' not found", controlID));
}
}
}


I can't check what the functionality of the ControlUtils is doing because it's a closed assembly.

I'm reverting back to rev. 346 as this was introduced in 347 and 348 :)

Cheers,
Timothy

geoffrey.mcgill
Sep 15, 2008, 12:07 AM
The defect has been fixed.

Timothy
Sep 15, 2008, 9:33 AM
Great thanks, will confirm later today or start a new thread if still broken. I'm sure its fine.

Cheers,
Timothy

Timothy
Sep 17, 2008, 6:28 PM
Argh, still happening but not with this example, I can't create a simplified solution but here is the exception I'm receiving:



Server Error in '/' Application.
The control with ID 'ctl24_CustomerDetail_drpAccountType' not found
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The control with ID 'ctl24_CustomerDetail_drpAccountType' not found

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The control with ID 'ctl24_CustomerDetail_drpAccountType' not found]
Coolite.Ext.Web.ScriptManager.RaisePostBackEvent(S tring eventArgument) +1394
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433


:(

Timothy

Timothy
Sep 17, 2008, 7:45 PM
ARRRGH, I finally got the example to work ... I mean fail ;)

Here is the 2 files:

Example.aspx:


<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected override void OnInit(EventArgs e)
{
Control control = Page.LoadControl("Example-Controls.ascx");

UserControl.Controls.Add(control);

base.OnInit(e);
}
protected void Page_Load(object sender, EventArgs e)
{
Permissions.DataSource = new object[]
{
new object[] {"Word"}
};
Permissions.DataBind();
}
protected void drpAccountType_Change(object sender, AjaxEventArgs e)
{

}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<p><a href="Example.aspx">Reload</a></p>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" Theme="Gray" />
<ext:Store ID="Permissions"
runat="server"
AutoLoad="True"
GroupField="GroupingName" IgnoreExtraFields="True">
<Reader>
<ext:JsonReader ReaderID="PermissionId">
<Fields>
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:JsonReader>
</Reader>
<SortInfo Field="DisplayName" />
</ext:Store>
<ext:GridPanel ID="dgPermission"
runat="server"
StoreID="Permissions"
AutoExpandColumn="DisplayName"
Border="False"
HideHeaders="True"
StripeRows="True">
<ColumnModel>
<Columns>
<ext:Column ColumnID="DisplayName" DataIndex="DisplayName" />
</Columns>
</ColumnModel>
</ext:GridPanel>
<asp:PlaceHolder ID="UserControl" runat="server" />
</form>
</body>
</html>


Example-Controls.ascx:


<%@ Control Language="C#" ClassName="Example_Control" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{

}
protected void txtTest_Change(object sender, AjaxEventArgs e)
{

}
protected void drpAccountType_Change(object sender, AjaxEventArgs e)
{
txtTest.Text = "Word";
}
</script>
<ExtJS:FieldSet ID="pnlAccount" runat="server" Title="Account Information">
<Content>
<table cellpadding="5" cellspacing="5" border="0" width="100%">
<tr>
<td>
<asp:PlaceHolder
<ext:TextField ID="txtTest" runat="server">
<AjaxEvents>
<Change OnEvent="txtTest_Change" />
</AjaxEvents>
</ext:TextField>
<ext:ComboBox ID="drpAccountType" runat="server" Editable="False" ForceSelection="True" Mode="Local" Select&#111;nfocus="True" TypeAhead="True" Width="255">
<AjaxEvents>
<Change OnEvent="drpAccountType_Change" />
</AjaxEvents>
<SelectedItem Text="Customer" Value="Customer" />
<Items>
<ext:ListItem Text="Customer" Value="Customer" />
<ext:ListItem Text="Employee" Value="Employee" />
</Items>
</ext:ComboBox>
</td>
</tr>
</table>
</Content>
</ExtJS:FieldSet>


Bloody hard one to create an example for, here are the replication steps:

1. Load page
2. Change the combo box value
3. Notice exception

4. Remove GridPanel
5. Reload page
6. Change the combo box value
7. Works

Cheers,
Timothy