PDA

View Full Version : [FIXED] [V0.7.0] Parameter JavaScript Error



Timothy
Oct 03, 2008, 12:58 AM
Hello,

If you run the following example, you'll notice that the base parameter is getting confused which drpPermissions combobox to retrieve the ClientID from, and I believe it just grabs the first one even though the first one is not visible [Smile]

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 control1 = Page.LoadControl("Example-Control.ascx");

UserControl1.Controls.Add(control1);

Control control2 = Page.LoadControl("Example-Control.ascx");

UserControl2.Controls.Add(control2);

base.OnInit(e);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<ext:ScriptManager ID="ScriptManager2" runat="server" StateProvider="PostBack" />
<ExtJS:Panel runat="server" Border="False" Visible="False">
<Content>
<asp:PlaceHolder ID="UserControl1" runat="server" />
</Content>
</ExtJS:Panel>
<ExtJS:Panel runat="server" Border="False">
<Content>
<asp:PlaceHolder ID="UserControl2" runat="server" />
</Content>
</ExtJS:Panel>
</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)
{
Permissions.DataSource = new object[] {
new object[] { 1, "Permission", "Permission 1" },
new object[] { 2, "Permission", "Permission 2" },
new object[] { 3, "Permission", "Permission 3" },
new object[] { 4, "Permission", "Permission 4" },
new object[] { 5, "Permission", "Permission 5" },
new object[] { 6, "Permission", "Permission 6" }
};
Permissions.DataBind();
}
</script>
<ext:Store ID="Permissions"
runat="server"
AutoLoad="True"
GroupField="GroupingName">
<Reader>
<ext:ArrayReader ReaderID="PermissionId">
<Fields>
<ext:RecordField Name="PermissionId" />
<ext:RecordField Name="GroupingName" />
<ext:RecordField Name="DisplayName" />
</Fields>
</ext:ArrayReader>
</Reader>
<BaseParams>
<ext:Parameter Name="PermissionId" Value="#{drpPermissions}.getValue()" Mode="Raw" />
</BaseParams>
<SortInfo Field="DisplayName" />
</ext:Store>
<ext:ComboBox ID="drpPermissions" runat="server" StoreID="Permissions" DisplayField="DisplayName" Mode="Local" ValueField="PermissionId" />

I know it's a funny scenario, but I do use the name drpPermissions in numerous controls, and sometimes they can be loaded on the same page, although not visible.

Cheers,
Timothy

geoffrey.mcgill
Oct 03, 2008, 10:11 AM
Confirmed. This is a bug. We are working on a fix.

Timothy
Oct 03, 2008, 10:14 AM
Great thanks Geoffrey, just reply here and I'll confirm SVN.

Cheers,
Timothy

Vladimir
Oct 03, 2008, 2:49 PM
Hi Timothy,

the fix in SVN

Timothy
Oct 03, 2008, 4:06 PM
Appears to be resolved, I'm getting another JavaScript error for a RequiredFieldValidator that is not visible, but I'll start a new post on that one once I track it down and replicate it.

Thanks vlad!

Cheers,
Timothy