Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Wednesday, March 28, 2012

TreeView + UpdatePanel Problems

Hi there!

I think Imight have come across a bug with theasp:TreeView control when combined with theatlas:UpdatePanel.
If you take the following code, everything works fine:

<%@dotnet.itags.org.PageLanguage="VB"%>
<!DOCTYPEhtml PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<scriptrunat="server">
Protected Sub tv_SelectedNodeChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)
tb.Text = tv.SelectedNode.Text
End Sub
</script>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Tree View Problem</title>
</head>
<body>
<formid="form1"runat="server">
<p>Click on a node of the Treeview below and its text should be put into the text box</p>
<atlas:ScriptManagerrunat="server"ID="scriptManager"EnablePartialRendering="true" />
<asp:TreeViewID="tv"runat="server"OnSelectedNodeChanged="tv_SelectedNodeChanged"ImageSet="XPFileExplorer">
<Nodes>
<asp:TreeNodeText="Books"Value="Books">
<asp:TreeNodeText="Practical C-Sharp"Value="1"></asp:TreeNode>
<asp:TreeNodeText="Mastering VB.Net"Value="2"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNodeText="Movies"Value="3">
<asp:TreeNodeText="Kill Bill vol. 1"Value="4"></asp:TreeNode>
<asp:TreeNodeText="Dodgeball"Value="5"></asp:TreeNode>
<asp:TreeNodeText="Anchorman"Value="6"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<atlas:UpdatePanelID="up"runat="server">
<ContentTemplate>
<asp:TextBoxID="tb"runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTriggerControlID="tv"EventName="SelectedNodeChanged" />
</Triggers>
</atlas:UpdatePanel>
</form>
</body>
</html>

However, things stop working when you either:

    AddShowLines="true" to theasp:TreeView declarationChange theImageSet="XPFileExplorer" attribute to be any of the following:
      CustomSimpleSimple2Bulleted ListBulleted List 2Bulleted List 3Bulleted List 4NewsInboxEventsFaq

I think that the reason for this is because the javascript emitted by the TreeView control is not enclosed in aCDATA section, and that the image array created by the control contains-- e.g.

WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsnId--TqhIqRaQpDEdAXI1&t=632745594511093750

Is there something I'm doing wrong, or is this a bug??
Can anyone find any workarounds?

Thanks,

James

James,

I copied the code into a webform and it works fine. I'm using the January atlas release, and I set the ImageSet to simple, ShowLines=True.


Ditto.

?
-Jarred


Thanks for looking into this! I too am using the January Atlas release and the production release of VS 2005. It seems that there's something else that combines with what I've done to produce my problem...

I am now sure that the problem is caused by WebResource.axd. Unfortunately, in the cut down version I have posted here, it doesn't seem to cause problems, yet in my project with other stuff it does!!Big Smile [:D]

I've been running this through the debugger, and things fail for me in line 7908 of Atlas.js in the this._onFormSubmitCompleted function. The problem is that the XML being returned is not valid XML. In certain instances (which IyetEmbarrassed [:$] cannot reproduce in a postable WebForm), the TreeView control emits the following javascript:

<script type=\"text/javascript\">
<!--
var tv_ImageArray = new Array('', '', '', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pl_2e6xumozXPxYZqFu17PU1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsnId--TqhIqRaQpDEdAXI1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pk_e4bsUT9bWDQ2MWH-6gpc1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PjqjY2emDMTu7ALA2nDCIXo1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pv8QeO4S4U4ZwyegfXWDlbg1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PjAIez-8ow-4yoCeUf2R1NU1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PnLYFcxMpAQWCUPvYCAlm0qWW6_VlLmh06LMY4dY_39r0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PkHrkGmpuj_GUXpuvKIVAJI1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PqfwXpRXxKUp70BWnakVlUQ1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pvxj7JAJj09InIxeJ_LgA78Lw4DU99zuy7Na9XpyN2cc0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PgSeXXVCCjUnj7qCKu8r_A81&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsSTmdNqcCGmREMlvsvL9QA1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pp4TTumvW-_PLz8ebD3KoT9Z_tUGh00juR7o9DwAVnTq0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsRjUwO9jm3UD68bicsdKr41&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pm9FxT3vcf0QM-lXmRYmAcJaCUvMut3EmQU2MCigmEjU0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Poa-rVynqR4YhbbIt9Et1MRhkG5zN4ey7kas6zi44Uba0&t=632745594511093750');
// -->
</script>

Now the problem with this is that (in this instance) the 2nd resource contains three hyphens "--"... and this is not valid XML, as XMLDom expects this to be -->!!Smile [:)]

The javascript rendered by the TreeView control seems to go completely against the guidelines that MS sets out inhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNETusStan.asp, where in point 9 under "Creating XHTML Pages" we are told that "The contents of<script> and<style> elements must be wrapped in CDATA sections."Wink [;)]

So at this point in Atlas.js, response.get_data() returns the following:

<delta><rendering><head><title>
Tree View Problem
</title><style type="text/css">
.atlas__delta { font-family:Lucida Console; }
.tv_0 { text-decoration:none; }

</style></head><form name="form1" method="post" action="Default5.aspx" id="form1">
<div>
<input type="hidden" name="tv_ExpandState" id="tv_ExpandState" value="ennennn" />
<input type="hidden" name="tv_SelectedNode" id="tv_SelectedNode" value="tvt6" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="tv_PopulateLog" id="tv_PopulateLog" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTQ3MDQwNDUzNA9kFgICBA9kFgICAw88KwAJAgAPFgYeDU5ldmVyRXhwYW5kZWRkHgxTZWxlY3RlZE5vZGUFBHR2dDYeCUxhc3RJbmRleAIHZAgUKwADZBQrAAIWAh4IRXhwYW5kZWRnFCsAA2QUKwACFgIfA2dkFCsAAhYCHwNnZBQrAAIWAh8DZxQrAARkFCsAAhYCHwNnZBQrAAIWAh8DZ2QUKwACFgQfA2ceCFNlbGVjdGVkZ2RkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBQJ0dsRdhXgThnE10BW40FEMjizxq93a" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>


<script src="http://pics.10026.com/?src=/AtlasWebSite1/WebResource.axd?d=Yq1-cqrnodOdYLOHDjipoA2&t=632745594511093750" type="text/javascript"></script>


<script src="http://pics.10026.com/?src=/AtlasWebSite1/WebResource.axd?d=8Qz3IJF2us-avEkYWU7p3g2&t=632745594511093750" type="text/javascript"></script>
<script>
<!--
function TreeView_PopulateNodeDoCallBack(context,param) {
WebForm_DoCallback(context.data.treeViewID,param,TreeView_ProcessNodeData,context,TreeView_ProcessNodeData,false);
}
// -->
</script>
<panelContent id="up"><![CDATA[

<input name="tb" type="text" value="Anchorman" id="tb" />
]]></panelContent>

<script type="text/javascript">
<!--
var tv_ImageArray = new Array('', '', '', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pl_2e6xumozXPxYZqFu17PU1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsnId--TqhIqRaQpDEdAXI1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pk_e4bsUT9bWDQ2MWH-6gpc1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PjqjY2emDMTu7ALA2nDCIXo1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pv8QeO4S4U4ZwyegfXWDlbg1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PjAIez-8ow-4yoCeUf2R1NU1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PnLYFcxMpAQWCUPvYCAlm0qWW6_VlLmh06LMY4dY_39r0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PkHrkGmpuj_GUXpuvKIVAJI1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PqfwXpRXxKUp70BWnakVlUQ1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pvxj7JAJj09InIxeJ_LgA78Lw4DU99zuy7Na9XpyN2cc0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PgSeXXVCCjUnj7qCKu8r_A81&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsSTmdNqcCGmREMlvsvL9QA1&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pp4TTumvW-_PLz8ebD3KoT9Z_tUGh00juR7o9DwAVnTq0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8PsRjUwO9jm3UD68bicsdKr41&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Pm9FxT3vcf0QM-lXmRYmAcJaCUvMut3EmQU2MCigmEjU0&t=632745594511093750', '/AtlasWebSite1/WebResource.axd?d=9G92-mY7CscAg6O7lwv8Poa-rVynqR4YhbbIt9Et1MRhkG5zN4ey7kas6zi44Uba0&t=632745594511093750');
// -->
</script>

<div>

<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCQKH85qQDwLM76LvDALF75m7CAKHpcXIAgKHpdGjCQKBgIwCApf6maAIApf65ZsHApf68fYP70RolxkG7u2i0qsPezZ/X1yrQs8=" />
</div>

<script type="text/javascript">
<!--

WebForm_InitCallback();var tv_Data = new Object();
tv_Data.images = tv_ImageArray;
tv_Data.collapseToolTip = "Collapse {0}";
tv_Data.expandToolTip = "Expand {0}";
tv_Data.expandState = theForm.elements['tv_ExpandState'];
tv_Data.selectedNodeID = theForm.elements['tv_SelectedNode'];
for (var i=0;i<19;i++) {
var preLoad = new Image();
if (tv_ImageArray[i].length > 0)
preLoad.src = tv_ImageArray[i];
}
tv_Data.lastIndex = 7;
tv_Data.populateLog = theForm.elements['tv_PopulateLog'];
tv_Data.treeViewID = 'tv';
tv_Data.name = 'tv_Data';
// -->
</script>
</form></rendering><deltaPanels>up</deltaPanels><xmlScript><page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components />
</page></xmlScript></delta>

But response.get_xml() returns nothing, because it is not valid XML!!

I'm going to try and get a concise reproducable example, but in the meantime, if anyone could comment on the above it would be greatly appreciated!!

Cheers,

James


OK... I've spent a bit more time on this and found out the following information:

The problem is not reproducible with a fixed example.

For anyone that's actually interested...

I raised this as a bug with Microsoft... you can see the gory details athttp://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=96bfa645-1b02-4b10-92bd-8aafe70e6d54

But in essence they have said:

Resolved as Duplicate by Microsoft on 2006-02-21 at 10:46:28
Thanks for your feedback regarding the Treeview not emitting javascript in CDATA sections

We plan to fix this problem, but no definite time can be given


Hi,

Is there a work around for this problem, its a show stopper for using Atlas in my project with this bug.

Thanks for any help.


Hi Paul!

Unfortunately, there is no workaround to the control not emitting the CDATA section. MS have known about this for some time (i.e. last summer), but have done nothing with it. Hopefully it will get sorted in SP1 of the framework!

However, if your problems are only being caused by the -- string in the WebResource.axd parameter then you can fix it. Basically, what you'll have to do is create a new project and then copy and paste your existing code into it.

I know this is a huge pain in the backside, but it's the only way around it!!! You might also find that when you come to deploy, it doesn't work... so you then have to uninstall the deployment and redeploy until it does work!!!

Cheers,

James


Hi James,

I am able to work with TreeView Control perfectly without any issues, but it stop working in Firefox after the hit to the child node which calls the partial update to the adjacent panel.

I dont see any javascript error in the Javascript console.
also everything is working absolutely fine in both browsers when i eliminate the Atlas coding.

HEre is the outlined part of the aspx file.
--------

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="Default"EnableEventValidation="false"%>

<

html>

<

headid="Head1"runat="server"><title>Duty Station Directory</title><linkhref="site.css"rel="stylesheet"type="text/css"/><linkrel="stylesheet"type="text/css"href="siteprint.css"media="print"/>

</

head>

<

SCRIPTlanguage="javascript">

function

scrollTop()

{

document.getElementById(

'RightPanel').scrollTop=0;

}

function

fnTrapKD(btn,event){if (document.all){if (event.keyCode == 13){event.returnValue=false;event.cancel =true;

btn.click();

}

}

elseif (document.getElementById){if (event.which == 13){event.returnValue=false;event.cancel =true;

btn.click();

}

}

elseif(document.layers){if(event.which == 13)

{

event.returnValue=false;event.cancel =true;

btn.click();

}

}

}

</

SCRIPT>

<

body><atlas:ScriptManagerrunat="server"ID="ScpMgr"EnablePartialRendering="true"/><formid="thisFrm"runat="server"><tableclass="PageWidth"><tr><tdclass="Header">Duty Station Directory</td><tdclass="SearchRow"style="width: 45%">

Search

<asp:TextBoxID="txtSearch"runat="server"/><asp:ButtonCssClass="MenuButton"id="btnSearch"Text="Go"runat=serverOnClick="btnSearch_Click"/><atlas:UpdatePanelID="ErrorUpdtPanel"runat="server"Mode="Conditional"RenderMode="Inline"><ContentTemplate><asp:LabelID="lblErr"CssClass="errMessage"Text="Please enter text to search..."runat="server"Visible="false"/></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="btnSearch"EventName="Click"/></Triggers></atlas:UpdatePanel></td></tr></table><asp:XmlDataSourceID="HCRXML"runat="server"DataFile="~/App_Data/HCRDIR_.XML"TransformFile="~/App_Data/XXXXXXX.xsl"/><tableclass="PageWidth Layout PageTable"><tr><tdclass="TreeLayout"><atlas:UpdatePanelID="UpdatePanel1"runat="server"RenderMode="Inline"Mode="Conditional"><ContentTemplate><divid="TreePanel"runat="server"Class="PageTable PanelTree"><atlas:UpdatePanelID="TreeUpdtPanel"runat="server"RenderMode="Inline"Mode="Conditional"><ContentTemplate><asp:TreeViewID="TreeHCR"runat="server"DataSourceID="HCRXML"OnSelectedNodeChanged="TreeHCR_SelectedNodeChanged"ShowLines="True"ExpandDepth="1"ShowExpandCollapse="true"><DataBindings><asp:TreeNodeBindingDataMember="DutyStationDirectory"PopulateOnDemand="True"SelectAction="SelectExpand"Text="XXXXXXXXXXXXXXXXXX"Value="root"/><asp:TreeNodeBindingDataMember="Country"PopulateOnDemand="True"SelectAction="Expand"TextField="title"ValueField="id"/><asp:TreeNodeBindingDataMember="dsCity"TextField="title"ValueField="id"/></DataBindings><RootNodeStyleCssClass="nodeType rootNode"ImageUrl="~/Images/root.gif"/><ParentNodeStyleCssClass="nodeType parentNode"ImageUrl="~/Images/folder.gif"/><LeafNodeStyleCssClass="nodeType leafNode"ImageUrl="~/Images/page.gif"/><SelectedNodeStyleCssClass="nodeType selectedNode"/></asp:TreeView></ContentTemplate></atlas:UpdatePanel></div></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="RepeaterSearchResults"EventName="ItemCommand"/></Triggers></atlas:UpdatePanel></td><tdclass="DetailLayout"><atlas:UpdateProgressID="UpdateProgressLabel"runat="server"><ProgressTemplate><imgsrc="Images/indicator.gif"/></ProgressTemplate></atlas:UpdateProgress><asp:Panelid="RightPanel"CssClass="PageTable PanelDetail"runat="Server"><atlas:UpdatePanelID="DetailUpdtPanel"runat="server"Mode="Conditional"RenderMode="Inline"><ContentTemplate><asp:PanelID="DetailPanel"runat="server"><divclass="InfoDetailTable"runat="server"id="divDtls"/></asp:Panel></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="RepeaterSearchResults"EventName="ItemCommand"/><atlas:ControlEventTriggerControlID="TreeHCR"EventName="SelectedNodeChanged"/><atlas:ControlEventTriggerControlID="btnSearch"EventName="Click"/></Triggers></atlas:UpdatePanel><atlas:UpdatePanelID="SearchResultsUpdtPanel"runat="server"Mode="Conditional"><ContentTemplate><asp:PanelID="SearchPanel"runat="server"><asp:RepeaterID="RepeaterSearchResults"runat="server"OnItemCommand="RepeaterSearchResults_ItemCommand"><HeaderTemplate><H1class="Title">Total Matches found for '<i><%# Keyword %>'</i> : <%# TotalResults %></H1></HeaderTemplate><ItemTemplate><divclass="lightRow"><divclass="links"><asp:LinkButtonID="DetailLink"runat="server"CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Country_Id") + "#" + DataBinder.Eval(Container.DataItem, "dsCode") %> '> <%#DataBinder.Eval(Container.DataItem,"OfficeType") %></asp:LinkButton></div><!-- <div class="ResHeading"> <%# DataBinder.Eval(Container.DataItem, "OfficeType") %> </div> --><divclass="Resdetails"> <%#DataBinder.Eval(Container.DataItem,"dsCode") %> -

<%

#DataBinder.Eval(Container.DataItem,"dsCity") %></div></div></ItemTemplate><AlternatingItemTemplate><divclass="darkRow"><divclass="links"><asp:LinkButtonID="DetailLink"runat="server"CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Country_Id") + "#" + DataBinder.Eval(Container.DataItem, "dsCode") %> '> <%#DataBinder.Eval(Container.DataItem,"OfficeType") %></asp:LinkButton></div><divclass="Resdetails"> <%#DataBinder.Eval(Container.DataItem,"dsCode") %> -

<%

#DataBinder.Eval(Container.DataItem,"dsCity") %></div></div></AlternatingItemTemplate></asp:Repeater><divid="Navigation"runat="server"><asp:LinkButtonID="PreviousPageNav"CssClass="leftnav"runat="server"CommandName="Previous"OnCommand="PageNav_Command"><< Previous | </asp:LinkButton><asp:LabelID="PagerLocation"CssClass="numnav"runat="server"/><asp:LinkButtonID="NextPageNav"CssClass="rightnav"runat="server"CommandName="Next"OnCommand="PageNav_Command"> | More>></asp:LinkButton></div></asp:Panel></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="RepeaterSearchResults"EventName="ItemCommand"/><atlas:ControlEventTriggerControlID="TreeHCR"EventName="SelectedNodeChanged"/><atlas:ControlEventTriggerControlID="btnSearch"EventName="Click"/><atlas:ControlEventTriggerControlID="PreviousPageNav"EventName="Command"/><atlas:ControlEventTriggerControlID="NextPageNav"EventName="Command"/></Triggers></atlas:UpdatePanel>

</asp:Panel></td></tr></table></form>

</

body>

</

html>
------------------

I hope someone would have faced the same error and can help me to rectify it.
James

TreeView inside detailsView throws javascript error

Hi,

I have a DetailsView control inside which I place a treeview control. For EditItemTemplate, I set the following property for the treeview control - ShowCheckBoxes="All". For ItemTemplate this property is not set. It is working fine.

But when I place this detailsView inside an updatePanel, it is throwing javascript error. The error is thrown when I click on the expand node of the treeview control. This javascript error is thrown only in Edit Mode of the detailsview.

The javascript error is "ct100_ContentPlaceHolder1_DetailsView1_TreeView1_Data is undefined.". In ReadOnly Mode, the javascript error is not thrown and the node is expanded properly.

What could be the problem?

Thanks & Regards,

Maya

Hi,
????I write some testing codes to check if there is any javascript error to happen.But it works fine.I install Ajax Beta 2 and Visual Studio 2005.Here are my testing codes for your reference.
<div>
<asp:UpdatePanel ID="upTree" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataSourceID="SqlDataSource1" AllowPaging="True" CellPadding="4" ForeColor="Black" GridLines="Vertical" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px">
<Fields>
<asp:TemplateField>
<ItemTemplate>
<asp:TreeView ID="TreeView1" runat="server">
<Nodes>
<asp:TreeNode Text="File" Value="File">
<asp:TreeNode Text="New" Value="New"></asp:TreeNode>
<asp:TreeNode Text="Open" Value="Open"></asp:TreeNode>
<asp:TreeNode Text="Exit" Value="Exit"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="Edit" Value="Edit"></asp:TreeNode>
<asp:TreeNode Text="WebSite" Value="WebSite"></asp:TreeNode>
<asp:TreeNode Text="Build" Value="Build"></asp:TreeNode>
<asp:TreeNode Text="Debug" Value="Debug"></asp:TreeNode>
<asp:TreeNode Text="Format" Value="Format"></asp:TreeNode>
<asp:TreeNode Text="Help" Value="Help"></asp:TreeNode>
</Nodes>
</asp:TreeView>
</ItemTemplate>
<EditItemTemplate>
<asp:TreeView ID="TreeView2" runat="server" ShowCheckBoxes="All">
<Nodes>
<asp:TreeNode Text="File" Value="File">
<asp:TreeNode Text="New" Value="New"></asp:TreeNode>
<asp:TreeNode Text="Open" Value="Open"></asp:TreeNode>
<asp:TreeNode Text="Exit" Value="Exit"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="Edit" Value="Edit"></asp:TreeNode>
<asp:TreeNode Text="WebSite" Value="WebSite"></asp:TreeNode>
<asp:TreeNode Text="Build" Value="Build"></asp:TreeNode>
<asp:TreeNode Text="Debug" Value="Debug"></asp:TreeNode>
<asp:TreeNode Text="Format" Value="Format"></asp:TreeNode>
<asp:TreeNode Text="Help" Value="Help"></asp:TreeNode>
</Nodes>
</asp:TreeView>
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"
ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
<asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />
<asp:CommandField ShowEditButton="True" />
</Fields>
<FooterStyle BackColor="#CCCC99" />
<EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F7DE" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ProductConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName], [UnitPrice] FROM [Product]" DeleteCommand="DELETE FROM [Product] WHERE [ProductID] = @.ProductID" InsertCommand="INSERT INTO [Product] ([ProductName], [UnitPrice]) VALUES (@.ProductName, @.UnitPrice)" UpdateCommand="UPDATE [Product] SET [ProductName] = @.ProductName, [UnitPrice] = @.UnitPrice WHERE [ProductID] = @.ProductID">
<DeleteParameters>
<asp:Parameter Name="ProductID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="UnitPrice" Type="Double" />
<asp:Parameter Name="ProductID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="UnitPrice" Type="Double" />
</InsertParameters>
</asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="DetailsView1" />
</Triggers>
</asp:UpdatePanel>
</div>
Can you post your codes here? This will help us to fix the javascript error.

Hi,

Please find the code requested pasted below. The detailsview uses an xml datasource to bind. I am pasting that xml file also at the end. When I click on the + sign beside the File Item in the Treeview, it throws javascript error. This happens only when the detailsview is in edit mode. This error does not occur if I simply remove the asp:updatepanel tags. Any idea where I might be going wrong?

<%

@.PageLanguage="C#"MasterPageFile="~/mastertest.master"AutoEventWireup="true"CodeFile="test.aspx.cs"Inherits="test"Title="Untitled Page" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">

<

asp:ScriptManagerProxyrunat="server"Id="ScriptManager1"></asp:ScriptManagerProxy>

<

tableborder="0"width="100%"cellpadding="0"cellspacing="0"class="body">

<tr><td><asp:UpdatePanelrunat="server"Id="ViewUpdatePanel"><ContentTemplate><asp:DetailsViewID="DetailsView1"runat="server"AutoGenerateDeleteButton="True"AutoGenerateEditButton="True"AutoGenerateInsertButton="True"AutoGenerateRows="False"DataSourceID="GroupDataSource"Height="50px"Width="100%"SkinID="Det"><Fields><asp:BoundFieldDataField="ID"HeaderText="ID"SortExpression="ID"/><asp:TemplateFieldHeaderText="Modules"><EditItemTemplate><asp:TreeViewID="TreeView1"runat="server"ShowCheckBoxes="All"ExpandDepth="0"><Nodes><asp:TreeNodeText="File"Value="File"><asp:TreeNodeText="New"Value="New"></asp:TreeNode><asp:TreeNodeText="Open"Value="Open"></asp:TreeNode><asp:TreeNodeText="Exit"Value="Exit"></asp:TreeNode></asp:TreeNode><asp:TreeNodeText="Edit"Value="Edit"></asp:TreeNode><asp:TreeNodeText="WebSite"Value="WebSite"></asp:TreeNode></Nodes></asp:TreeView></EditItemTemplate>

<ItemTemplate> <asp:TreeViewID="TreeView3"runat="server"ExpandDepth="0"><Nodes><asp:TreeNodeText="File"Value="File"><asp:TreeNodeText="New"Value="New"></asp:TreeNode><asp:TreeNodeText="Open"Value="Open"></asp:TreeNode><asp:TreeNodeText="Exit"Value="Exit"></asp:TreeNode></asp:TreeNode><asp:TreeNodeText="Edit"Value="Edit"></asp:TreeNode><asp:TreeNodeText="WebSite"Value="WebSite"></asp:TreeNode></Nodes></asp:TreeView></ItemTemplate></asp:TemplateField></Fields></asp:DetailsView></ContentTemplate></asp:UpdatePanel><asp:XmlDataSourceID="GroupDataSource"runat="server"DataFile="~/Group.xml"></asp:XmlDataSource></td></tr>

</

table>

</

asp:Content>

***************************XML FILE(Group DataSource)**********************************

<?

xmlversion="1.0"encoding="utf-8" ?>

<Groups>

<

GroupID="Admin"Name="Admin Group"GroupType="User">

</

Group>

</

Groups>

********************XML FILE***************************************

Thanks,

Maya


I tested your codes and got the same javascript error as yours in your first post. We can not set asp:DetailsView for asynchronous post back in asp:UpdatePanel.Maybe this is a bug of asp:UpdatePanel in Ajax Beta 2.It can work fine if we set <asp:PostBackTrigger ControlID="DetailsView1"/>
Try to change your codes as the following and it works fine,but there will be postback to take place.Otherwise we need to look forward to Ajax another release.Wish this bug could be solved in the near future.
<asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1"></asp:ScriptManagerProxy>
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>
<asp:UpdatePanel runat="server" ID="ViewUpdatePanel" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True" AutoGenerateInsertButton="True" AutoGenerateRows="False"
DataSourceID="GroupDataSource" Height="50px" Width="100%" SkinID="Det">
<Fields>
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
<asp:TemplateField HeaderText="Modules">
<EditItemTemplate>
<asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" ExpandDepth="0" >
<Nodes>
<asp:TreeNode Text="File" Value="File">
<asp:TreeNode Text="New" Value="New"></asp:TreeNode>
<asp:TreeNode Text="Open" Value="Open"></asp:TreeNode>
<asp:TreeNode Text="Exit" Value="Exit"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="Edit" Value="Edit"></asp:TreeNode>
<asp:TreeNode Text="WebSite" Value="WebSite"></asp:TreeNode>
</Nodes>
</asp:TreeView>
</EditItemTemplate>
<ItemTemplate>
<asp:TreeView ID="TreeView3" runat="server" ExpandDepth="0" >
<Nodes>
<asp:TreeNode Text="File" Value="File">
<asp:TreeNode Text="New" Value="New"></asp:TreeNode>
<asp:TreeNode Text="Open" Value="Open"></asp:TreeNode>
<asp:TreeNode Text="Exit" Value="Exit"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="Edit" Value="Edit"></asp:TreeNode>
<asp:TreeNode Text="WebSite" Value="WebSite"></asp:TreeNode>
</Nodes>
</asp:TreeView>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="DetailsView1"/>
</Triggers>
</asp:UpdatePanel>
<asp:XmlDataSource ID="GroupDataSource" runat="server" DataFile="~\XML\Group.xml"></asp:XmlDataSource>
</td>
</tr>
</table>
Wish this can help you.
Hi,Thanks for the reply. Even I wish that this bug will be solved in the next release. Regards,Maya

Thanks a lotJasson, this simple solution helped me a lot.

Keep the good work going.

Smile

Monday, March 26, 2012

TreeView inside detailsView throws javascript error

Hi,

I have a DetailsView control inside which I place a treeview control. For EditItemTemplate, I set the following property for the treeview control - ShowCheckBoxes="All". For ItemTemplate this property is not set.

It is working fine. But when I place this detailsView inside an updatePanel, it is throwing javascript error. The error is thrown when I click on the expand node of the treeview control. This javascript error is thrown only in Edit Mode of the detailsview. The javascript error is "ct100_ContentPlaceHolder1_DetailsView1_TreeView1_Data".

In ReadOnly Mode, the javascript error is not thrown and the node is expanded properly.

What could be the problem?

Thanks & Regards,

Maya

While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of theother newsgroups such asAJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!

trigger event doesnt fire when target control in show/hide panel

I have the following code with the basic required elements to produce the problem:

1<body>2<form id="form1" runat="server">3<asp:ScriptManager ID="ScriptManager1" runat="server" />4<div>5<asp:UpdatePanel ID="UpdatePanel1" runat="server">6<ContentTemplate>7<ajaxToolkit:PopupControlExtender ID="PopupExtender" runat="server" TargetControlID="lbTest"8Position="Right" PopupControlID="buttonPanel">9</ajaxToolkit:PopupControlExtender>10<asp:ListBox ID="lbTest" runat="server" Width="154px"></asp:ListBox>11</ContentTemplate>12<Triggers>13<asp:AsyncPostBackTrigger ControlID="btnAddItem" EventName="Click" />14</Triggers>15</asp:UpdatePanel>16<br />17<asp:Panel runat="server" ID="buttonPanel">18<asp:Button ID="btnAddItem" runat="server" OnClick="btnAddItem_Click" Text="Button" />19</asp:Panel>20</div>21</form>22</body>

The click event is never fired, though the postback occurs.

Any thoughts? Am I doing something "illegal" with the arrangement here? I have a whole form I want to show only in certain circumstances, the results of which should trigger the event to update the main page. How would I do this with Atlas if the given arrangement doesn't work?

TIA, Jeff.

Jeff,

This problem occurs because the PopupControlBehavior's _onClick method calls e.stopPropagation(). That prevents the WebForms.PageRequestManager._onFormElementClick method from getting called. That prevents the asynch postback information from being created correctly. That prevents the asynch postback from working properly.

I believe Ted added the problematic call a long time ago to improve the UI of the PopupControl. I've just pointed him to this thread for more info...