Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Wednesday, March 28, 2012

Transforming plain ID to adorned ID

I must be missing something obvious here. Suppose I create an ASP.NET Web User Control, and I use a ModalPopupExtender inside it. In the ascx, I set various properties of the extender to refer to controls within the Web User Control, such as PopupDragHandleControlID="TitleText". At runtime, the control with ID "TitleText" gets a more complicated ID on the rendered page (call it an 'adorned' ID, not sure what the offical term is), such as "ctl00_ContentPlaceHolder1_MyCtrl1_TitleText". The behaviour javascript for the extender does things like -

this._dragHandleElement = $get(this._PopupDragHandleControlID);

That wouldn't work with the 'plain' ID, in fact by adding various alert() boxes I can see that _PopupDragHandleControlID has been transformed - somewhere - to the 'adorned' version. I've written an extender that declares and uses ID properties in just the same way, but they don't get transformed from the 'plain' version at runtime. So, I either have to use ugly workarounds like setting that ID programmatically from server-side code (e.g. MyExtender1.BlahID = MyBlahCtrl.ClientID), or ... figure out how to get that transformation to happen automatically like it seems to for ModalPopupExtender. Can anyone point me in the right direction?

(Note, I'm not talking about the TargetControlID property, so ResolveTargetControlID wouldn't come into it, and I'm talking about an extender that's right next to the controls in question.)

Thanks in advance for any leads.

Kevin.

All extender properties that reference ID's are decorated with theIDReferencePropertyAttribute. It helps converts server side ids into client versions so that the behavior can resolve them easily. If you look at the ModalPopupExtender.cs file, the PopupDragHandleControlID has that attribute and so so any other properties that are used to get control IDs.


Do you have any references that confirm that's so and detail where it occurs? The reasons I ask are 1. My extender's properties that ref IDs already have that attribute, and no such conversion occurs, and 2. The documentation for that attribute doesn't mention anything like that, merely that it can be used by designers to help out by giving a list of control IDs at design time - no mention of anything happening at runtime. But if that attribute is the answer and if you have more information on it, please do say so I can figure out why it isn't working for me.

Or does anyone else have details on how the conversion occurs for PopupDragHandleControlID et al?

Thanks in advance for any help

Kevin.


It happens in ExtenderBaseDesignerHelpers.cs file. It is part of the Toolkit framework. If you are building on top of ExtenderControlBase this is taken care of automatically.

Should have included these links earlier

http://ajax.asp.net/ajaxtoolkit/Walkthrough/CreatingNewExtender.aspx

http://ajax.asp.net/ajaxtoolkit/Walkthrough/ExtenderClasses.aspx


Aha. In fact, I had a hand-rolled extender built with ref to various online docs rather than one done as per that walkthrough, which when followed showed up I'd not got the ECB derivation stuff right. In the interim, I'd done some tracing through the ACT code and you're quite right, that attribute is used as a signal for the base classes to apply some transformation before serialising. Funny the docs don't mention that. Anyway, thanks for the pointers - it's running ok now.

Kevin.

Treating an ASCX control as independent

One huge disadvantage of the UpdatePanel control, IMHO, is that all of the Page life cycle reloads again.

I was wondering, when I just want to load a single control that has nothing to do with the rest of the stuff on the page, is this roundtrip really necessary?

I know that there's the client approach which says I can communicate with the server with minimal data and create all controls at the client-side, but that won't let me use server-controls and their benefits.

I thought of something that renders an ASCX control and serves its HTML, but it not covers everything, such as event firing.

Is my idea doable? Anyone bumped into this before?

Thanks!

If you want the benefits of the server controls you must also allow their life cycle to run. It's both the advantage and the disadvantage of the UpdatePanel.


Agreed... This is discussed here:http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous

One option is to use ASP.NET PageMethods (also described in that link) which simplifies WebMethod calls and only returns results and not much overhead. You can also use multiple UpdatePanels so that you aren't refreshing so much.

Hope this helps,

-Damien

Tree control

Hi,

I would like a scalable, extendable, customizable, localizable fully asynchronous tree control. Is such a beast available?

Many thanks!

TimHi Tim,

There isn't anything that does everything you want out of the box. Your best bet is to look at using the ASP.NETTreeView inside an "Atlas"UpdatePanel. The current issue of MSDN magazine actually has anarticle by Jeff Prosise exploring some practical ways of doing this.

Thanks,
Ted

Thanks Ted. It seems like a good candidate for addition to the toolkit. Ideally I would like to create a completely control driven application and implemented very cleanly. Best regards, Tim

Tree Control within Grid Control using AJAX and ASP.Net

Hi, I need a tree control inside a grid control, i.e.., every node of the tree should be a row in the grid control. I want to implemented this using AJAX. Please let me know how this has to be implemented.

Hi

every node of the tree should be a row in the grid control?

I'm afraid you cann't implement this,Html can be writed like this.

Best Regards

Tree Control within Grid Control using AJAX

Hi,
I need a tree control inside a grid control, i.e.., every node of the tree should be a row in the grid control.
I want to implemented this using AJAX. Please let me know how this has to be implemented.

Hi TinyTin,

I have found that you have posted the same thread on Asp.Net Ajax UI with this url: http://forums.asp.net/t/1141859.aspx. so we will mark it as "resolved", if you have any problems or new findings , please feel free to reply onhttp://forums.asp.net/t/1141859.aspx.

By the way, based on my experience, I'm afraid that we cannot achieve what you want by using any controls in Ajax Control Toolkit directly. Thanks.

Best Regards,

Jonathan

Tree view control with ajax

Hello,

I dont know, is this the right thread to post my prob. Here is my problem. I have a tree view control in a master page. I have created that tree view from "treeview.xml" file. I have created this file from database table. In this tree view, more than one node may have same name. My table has four fields - nodeid, nodename, parentid and lavel. The xml file looks like...

<?xml version='1.0' encoding='utf-8' ?>
<rootNode>
<siteNode title="root" id="1">
<siteNode title="my document" id="3">
<siteNode title="my films" id="31">
<siteNode title="bengalis" id="33">
<siteNode title="aaa102" id="102" />
<siteNode title="aaa106" id="106">
<siteNode title="xxxx1" id="1051" />
<siteNode title="xxxx1" id="1053" />
<siteNode title="zzzz2" id="1059" />
...
...
Every node may have more than one information. All these informations are stored in a different file with "nodeid". What I want is that when any one click on any node I want to display all the information stored in that node in the "Conten Page" with the help of Ajax. For that I need the id of that selected node. How can I access the node id?

Angshujit

Do you want the tree view to dynamically add nodes when you click one of the nodes? If so, you will have a lot of problems using the built in controls for that because the treeview is not supported inside an update panel. You can generally have a treeview in an update panel if it doesn't change the contents, but if you want it to change after page load, you should look at getting a 3rd part control for it.

Hello,

Thank you for your reply. No, I dont want so at present. Actually what is became my headache is how to get the id of the node.

protectedvoid SelectedNodeChanged(object sender,EventArgs e)

{

string id = treeView1.SelectedNode.?

Because without knowing the id I cannot search the table for contents belongs to that node. I cannot usetreeView1.SelectedNode.Text becasue there may be more than one nodes with same text. Is there any way to solve it? Please help me.

Angshujit

TreeView "MyTreeView_Data" is undefined

Hi,

I have a page with a TreeView control inside a webpart.

This page uses Atlas (July CTP), but not exactly in this webpart. That's why I am not sure if it's an Atlas problem or a standard ASP.NET problem.

When I click a node of the TreeView (to select it), sometimes I have this javascript error:

"A Runtime Error has occurred."
"Error: 'wpMgr_myTreeView_Data' is undefined"

The problem is aleatory. Doesn't happen always, only sometimes.

Any idea on what could be the cause?

Maybe Atlas July CTP exists some?issues?to?work?TreeView?node?in?WebPart.I?suggest?you?to?download?the?latest?Ajax?
Beta?2?and?Futures?November?CTP?to?try?if?it?works?fine.
Here are some sample codes about a TreeView in WebPartZone for your reference.
<WebPart:webpartmanager id="WebPartManager1" runat="server"></WebPart:webpartmanager>
<WebPart:webpartzone id="WebPartZone1" runat="server" bordercolor="#CCCCCC" font-names="Verdana"
padding="6" width="169px">
<PartChromeStyle BackColor="#F7F6F3" ForeColor="White" BorderColor="#E2DED6" Font-Names="Verdana"></PartChromeStyle>
<MenuLabelHoverStyle ForeColor="#E2DED6"></MenuLabelHoverStyle>
<EmptyZoneTextStyle Font-Size="0.8em"></EmptyZoneTextStyle>
<MenuLabelStyle ForeColor="White"></MenuLabelStyle>
<MenuVerbHoverStyle BackColor="#F7F6F3" BorderStyle="Solid" ForeColor="#333333" BorderWidth="1px" BorderColor="#CCCCCC"></MenuVerbHoverStyle>
<HeaderStyle ForeColor="#CCCCCC" HorizontalAlign="Center" Font-Size="0.7em"></HeaderStyle>
<MenuVerbStyle BorderStyle="Solid" ForeColor="White" BorderWidth="1px" BorderColor="#5D7B9D"></MenuVerbStyle>
<PartStyle ForeColor="#333333" Font-Size="0.8em"></PartStyle>
<TitleBarVerbStyle ForeColor="White" Font-Size="0.6em" Font-Underline="False"></TitleBarVerbStyle>
<MenuPopupStyle BackColor="#5D7B9D" BorderWidth="1px" BorderColor="#CCCCCC" Font-Size="0.6em" Font-Names="Verdana"></MenuPopupStyle>
<PartTitleStyle BackColor="#5D7B9D" ForeColor="White" Font-Size="0.8em" Font-Bold="True"></PartTitleStyle>
<ZoneTemplate>
<asp:TextBox ID="tbWebPart" runat="server" Height="19px" Width="197px"></asp:TextBox>
<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>
</ZoneTemplate>
</WebPart:webpartzone>
Wish this can give you some helps.

Treeview & UpdatePanel - Assertion failed - cant find last / in base url

Hi,

I am using a TreeView and couple of server controls. The treeview children are dynamically added on click of a node. I have the treeview control inside an update panel. Everything works if I access the page in a normal IE window. When I try to access the same page through a modal dialog, during postback, it opens a new window. To avoid that, I've added<base target = "_self" />.

Now I'm getting another error with Atlas. On click of tree node, it says "Assertion Failed : Can't find last / in base url. If I remove the <base..> it doesn't work.

Looking for an immediate solution. I've spent almost a day in googling. But no luck yet.

Many Thanks,
Mani.

hello.

you can also try using an iframe inside your popup page (ie, put only an iframe inside your popoup window which loads the page that shows the content)...maybe it'll solve that problem.


Mani,

Add:<basetarget="_self"href="http://localhost/***/***/"runat="server"/>

because our dear js function check if u have base tag , then try to concat with href value. in your case you don't have it.

T.


what if i'm using a Master Page - i can't hard code a path in the href. Is there any way to accomplish this? Plus - even if i hard code, the paging on my grid view does not work now.

trans642:

Mani,

Add:<basetarget="_self"href="http://localhost/***/***/"runat="server"/>

because our dear js function check if u have base tag , then try to concat with href value. in your case you don't have it.

T.

GOOD THANKS !


trans642:

Mani,

Add:<basetarget="_self"href="http://localhost/***/***/"runat="server"/>

because our dear js function check if u have base tag , then try to concat with href value. in your case you don't have it.

T.

GOOD THANKS !


Try this, without hard code urlSmile
 <base target="_self" href="<%=Request.Url.OriginalString%>" />

works perfect ... Thanks.

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 Control How can I trap a callback function

In my web application I have an Ajax Treeview control which populates its child nodes via AJAX, and all is working beautifully except that all our pages turn on a "spinny" image whenever there is a postback either full or partial my problem is how can I trap the completion of the ajax postback so I can turn the spinny off?

I cannot find a treeview event that I can trap on the client side to do this.

I expect someone has ran into this issue before so any help would be gratly appriciated.

I have only recently started using AJAX and so far everything I have seen has been really good but I would to solve this issue.

Cheers

John

How are you populating the tree? What "Ajax Treeview control" are you using?

You should be able to attach a callback handler that will let you get rid of the "spinny", but without knowing your approach I can't recommend how to do this in your instance.

-Damien


Hi Damien

Here is the markup for the treeview I have removed the styling for berevity

<asp:TreeViewID="tvwProcess"runat="server"EnableClientScript="true"OnTreeNodePopulate="GetChildren"PopulateNodesFromClient="true"Style="overflow: auto; height: 490px">

</asp:TreeView>

GetChildren is a serverside method which populates the expanded node

Does this give you enough info?

Thanks

John


You should be able to use the ClientScript.GetCallbackEventReference to get a reference to the callback and then hide the image using the callback method (seehttp://west-wind.com/weblog/posts/2302.aspx for an example).

Hope this helps...

-Damien


Hi Damien

re:

You should be able to use the ClientScript.GetCallbackEventReference to get a reference to the callback and then hide the image using the callback method (seehttp://west-wind.com/weblog/posts/2302.aspx for an example).

I tried your suggestion and got the example from west-wind working fine and also this example from Microsoft http://msdn2.microsoft.com/en-us/library/ms153106.aspx

the problem I still have with the treeview is what event to attach it to. The logical option would be the "OnTreeNodeExpanded" but that looks for a server side methodAm I missing something?CheersJohn

Hi,

At the client side,the"OnTreeNodeExpanded" is the click event of the parent Node.

Treeview in Ajax.Net

Hi,

I want to use Treeview control using Ajax.Net, that should refreshed without postback.
Please provide me guidance or sample code.

Thanks in Advance.

The Treeview control is not supported in the current release of ASP.NET Ajax. I have heard of people getting it working though by manually doing changes in the prerender event, although when we tried that there were always some errors. I would suggest the telerik Tree control, although it isn't free..

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!

Treeview inside an Accordion control issue

Hello all

I am having a problem with dynamically loading treenodes with treeview control inside an accordion control. I am gettting "object Reference not set" when adding a treenode to the treeview using the following code:

treeview.Nodes.Add(treenode)

If I pull the treeview out of the accordion control the same code works as expected.

Here is the code inside aspx:

<AjaxControlToolkit:Accordion

ID="accNavigation"

runat="server"

Width="250px"

FramesPerSecond="40"

TransitionDuration="250"

AutoSize="Fill"

SelectedIndex="0"

CssClass=""

HeaderCssClass="accordionHeader"

HeaderSelectedCssClass="accordionHeaderSelected"

ContentCssClass="accordionContent">

<Panes>

<AjaxControlToolkit:AccordionPane

ID="apMyEvaluations"

runat="server">

<Header>

<ahref=""onclick="return false;">My Evaluations</a>

</Header>

<Content>

<asp:TreeView

ID="tvMyEvaluations"

runat="server"

NodeIndent="18"

NodeStyle-HorizontalPadding="5"

SelectedNodeStyle-BackColor="navy"

SelectedNodeStyle-ForeColor="white"

ShowLines="true">

</asp:TreeView>

</Content>

</AjaxControlToolkit:AccordionPane>

<AjaxControlToolkit:AccordionPane

ID="AccordionPane2"

runat="server">

<Header>

<ahref=""onclick="return false;">Manager Listing</a>

</Header>

<Content>

<asp:TreeView

ID="tvManagerListing"

runat="server"

NodeIndent="0"

NodeStyle-HorizontalPadding="5"

SelectedNodeStyle-BackColor="navy"

SelectedNodeStyle-ForeColor="white"

ShowLines="true">

<Nodes>

<asp:TreeNodeText="Manager Listing"Value="L">

<asp:TreeNodeText="ASP .Net"Value="ASP"ImageUrl="Images/24_Manager.ico"></asp:TreeNode>

<asp:TreeNodeText="Visual Basic"Value="VB"ImageUrl="Images/24_Manager.ico"></asp:TreeNode>

</asp:TreeNode>

</Nodes>

</asp:TreeView>

</Content>

</AjaxControlToolkit:AccordionPane>

</Panes>

</AjaxControlToolkit:Accordion>

Below is the code used to build the tree nodes:

'TreeNode Declarations

Dim tnMyEvaluationsRootAs TreeNode

Dim tnPrimaryAs TreeNode

Dim tnSecondaryAs TreeNode

'Using the tree view for My Evaluations, populate tree nodes

WithMe.tvMyEvaluations

'Instaniate a new parent node

tnPrimary =New TreeNode("Primary","PRIMARY","~/Images/16_Copy.ico")

'Add primary evaluation

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 1","1","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 2","2","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 3","3","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 4","4","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 5","5","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 6","6","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 7","7","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 8","8","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 9","9","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 10","10","~/Images/16_User.ico"))

tnPrimary.ChildNodes.Add(New TreeNode("Employee, Some 11","11","~/Images/16_User.ico"))

'Instaniate a new parent node

tnMyEvaluationsRoot =New TreeNode("My Evaluations","MY_ROOT","~/Images/16_Copy.ico")

'Add primary evaluations to root node

tnMyEvaluationsRoot.ChildNodes.Add(tnPrimary)

'Add node to My Evaluations tree view

.Nodes.Add(tnMyEvaluationsRoot)

EndWith

Any help would be greatly appreciated.

Tom

Hi Tom,

I can't find the line "treeview.Nodes.Add(treenode)" in your code snippet.

According to your description, it seems treeview object is null. And such problem is usually caused by use FindControl to get reference to treeview object, you get null reference when the method fails. Please make sure the method is invoked on the right parent control.

If this doesn't help, please post relevant code.


Also, the treeview doesn't work well with most ajax things, including updatepanel (which could also be the source of your problem)..

A nice workaround is to use the treeview inside an iframe (just hide the frameborder and remove margins of the frame and noone will never know.. ;o) ).

TreeView Navigation and the Update Control

I am using Master pages, of which I have my Treeview that is used for navigation with a site map, and I have a child page with the FreeTextBox 3.1x on it that is being submitted with a LinkButton. I have all of this wrapped in a Update Panel with an asynchronous trigger on the LinkButton. Here's my problem: I can navigate to other pages using my TreeView navigation just fine if I do not click the LinkButton. If I do, it throws up a JavaScript error saying that Access is Denied. Any ideas?

The Current version des not support TreeView to host in the UpdatePanel. You will ge the complete list of the controls which does not support in update panel in the following link:
http://www.asp.net/AJAX/Documentation/Live/overview/UpdatePanelOverview.aspx Check the Controls that are not compatible section.

TreeView with checkboxes

Hi

As you know the nativ TreeView control does not populate the check state (when the attributeShowCheckBoxes="All") to his children nodes for perfomance reason.

Is it a way with Ajax and a timer to do the thing ?

I wrote this but i got flickering on the lines redraw of the TreeView

Any help ?

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="500" />
<asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
<ContentTemplate>
<asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" ShowLines="true" OnTreeNodeCheckChanged="OnSelectPlayer">
</asp:TreeView>
<br />
<asp:Button ID="Button1" runat="server" OnClick="OnSelect" Text="Valider la sélection" Width="127px" />
</ContentTemplate>
</asp:UpdatePanel>

Thank you a lot

Hi,

Please specify <compilation debug="false"> in web.config.

In asp.net, when in debug mode, images and javascript files severed from a web resource handler won't be cached on client.

Hope this helps.

Treeview with Drag and Drop behaviour

hallo,

is there a control which is like a treeview with drag and drop? i need a control which kan switch its notes via drag an drop. in best case you can swap notes between two treeviews.

at first i tried to do this with the reorder list but i can't define sub items with drag/drop behaviour.

has somebody an idea how i can realize such a control?

best regards

Saijado

Hi,

Recently I was going through the implementation of the 'flyTreeView' control. Check it to see if you can borrow some ideas :

http://www.9rays.net/asp.net_2/treeview/miscpages/doc/DragDrop.aspx

HTH,
Suprotim Agarwal

--
http://www.dotnetcurry.com
--


See Demo here

http://www.dhtmlgoodies.com/scripts/drag-drop-folder-tree/drag-drop-folder-tree.html

Info & Downloadhttp://www.dhtmlgoodies.com/index.html?whichScript=drag-drop-folder-tree


thanks a lot to you

Trigger a panel refresh from javascript/pure html control

Hi,

I have a pure HTML tree control, that is outside of an ajax UpdatePanel. I want to write a JS function that triggers a particular panel to refresh, *as if* I hit a submit button inside of the panel. I don't want to put the HTML tree control inside an Ajax panel, as it will loose it's state (it will return to a completely collapsed state).

Putting a button inside the panel, and then running the JSelement.click() event from my tree control works in IE, but Firefox submits the entire page(the submit event is not captured by the AJAX framework in FF in this case,apparently).

I have looked into the client reference documentation at http://ajax.asp.net/docs/ClientReference/Global/default.aspx, and it seems like there should be a way to trigger a postback/panel refresh, but I have not found a way.

The PageRequestManager does not help, since it only monitors existing page requests. I need to invoke a page request, and run something like

PageRequest.Invoke('MyUpdatePanel');

or

var ajaxpanel = document.getElementById('AjaxPanelClientID');
ajaxpanel.update();

A related suggestion:

It would be nice if the UpdatePanel supported client side triggers, not just server side triggers. Consider the following hypothetical code:

<ajax:UpdatePanel ID="ajxUpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<!-- CONTENT -->
</ContentTemplate>
<Triggers >
<ajax:AsyncPostBackTrigger ClientTriggerFunction="MyCustomTrigger" OnTrigger="MyCustomTrigger_ontrigger" />
</Triggers>
</ajax:UpdatePanel>

Then the system would automatically generate the JS function (with the appropriate .NET ajax framework calls that I don't need to know about), so I can call it anywhere on the page, from multiple HTML controls if needed.

<input type="button" value="MyHTMLButton" onclick="MyCustomTrigger('argstring');">

The system should enable a code-behind event handler where I can put my server side code:

protected void MyCustomTrigger_ontrigger(object sender, AjaxClientTriggerEventArgs e) {
//run some server side .NET code here
switch(e.ClientArgString){
...
}
}


You can trigger an asynchronous post back by invoking the __doPostBack function. Just pass in the ID of the control that's either inside an update panel or is marked as a trigger for one. Here's an example:

<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<asp:Button ID="myButton" runat="server" OnClick="myButton_Click" Text="Click me!" />
<asp:Label ID="myLabel" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<input id="myOtherButton" type="button" value="No, click me!" />
<script type="text/javascript">
function pageLoad() {
$addHandler($get('myOtherButton'), 'click', triggerAsyncPostBack);
}
function triggerAsyncPostBack(e) {
__doPostBack('<%= myButton.UniqueID%>', '');
}
</script>

One thing to watch out for is that the first parameter to __doPostBack needs to be the full ID of the control. If you're using master pages, your control IDs will be longer than they appear. Use the UniqueID property to get the full ID or the event handlers for your control won't run on the server.

Also, if you have event validation turned on (the default), you'll get an exception if you don't pass in a correct event argument as the second parameter to __doPostBack. For button controls, it should be the empty string. For other controls, it might be different, but you'll have to experiment to find out.

Hope this helps.


Thank you Jason,

That is the behaviour I was looking for, and it works in Firefox as well as IE. I knew about the _doPostBack function in general, but I did not know the syntax to call it.

Where is the best place to find documentation and syntax for the built-in ASP.NET and AJAX JS functions and calls? For example, I did not know about $get or $addHandler functions.

(I am familiar with similar functions from the prototype.js library).

Thanks again :-)


Another related discovery that is slightly more elegant (I am probably repeating what some already know...but I think its great :-)

Is is not necessary to use a button to trigger the post back inside the panel. I updated a hidden input field with a value, and then submitted thehidden field iteself with __doPostBack, and it worked great. I needed a hidden field to pass in a unique ID anyway, so the panel would know how to refresh itself.

Inside the UpdatePanel:

<input id="txtGroupID" type="hidden" runat="server" onserverchange="txtGroupID_ServerChange" />

JS code:

txt = $get("<%=this.txtGroupID.ClientID %>");
txt.value = somevalue;
__doPostBack("<%=this.txtMatGroupID.UniqueID %>","");



Douglas Smith:

Where is the best place to find documentation and syntax for the built-in ASP.NET and AJAX JS functions and calls? For example, I did not know about $get or $addHandler functions.

The ASP.NET AJAX documentation does document all of these functions. You'd have to know where to look, though. All of the $-prefixed functions seem to be documented in the Sys.UI namespace here:

http://ajax.asp.net/docs/ClientReference/Sys.UI/default.aspx

Browsing through the source code helps find the undocumented stuff.


That will trigger an asynchronous post back, but no event will be raised on the server with that control as the target. You probably want to execute some code to modify the controls inside the update panel or there'd be little point in triggering the asynchronous post back. That's why I used a button control in the example I gave you. If all you want to do is trigger the asynchronous post back and don't care about raising a specific event on the server, you could use the ID of the update panel control as the event target. To me, that would be stating the intention of what you're trying to do a little clearer.

If you don't want to use a button but do want to raise an event on the server, you can use any control that implements IPostBackEventHandler as the event target. Those controls have a RaisePostBackEvent method that gets invoked when a post back is received with their ID as the event target. For button controls, they raise their Click event in that method. That's where your code gets to do its stuff. You could easily create an "empty" custom control that didn't render anything, but could be used as the event target. (I tried using the page control for this, but there's code that prevents you from registering the page as an asynchronous post back trigger.)

It'd be nice if the UpdatePanel control itself implemented IPostBackEventHandler and raised some sort of custom event on the server that let you do this without having to write much custom code. You could simulate this a bit by putting some code inside one of the event handlers on your page and checking to see if the ScriptManager control's AsyncPostBackSourceElementID is the ID of the UpdatePanel control you used as the event target. If so, execute your custom code.

Hope this helps.

Trigger control outside the updatepanel

Hello,

I need that the control typed in the "ControlID" property of a trigger, to be outside of the updatepanel.

If I put the button inside of the updatepanel, atlas works correctly.

But if I put the button outside of the updatepanel, the button_Click event is doing a complete postback of the entire page.

I want to put the button outside, because i don't want to load the same button one more time, just want to refresh the updatepanel when this button is clicked.

I hope you can understand. You can note my english is not very well.

Thanks!

You can make the button_Click handler call the UpdatePanelName.Update() function to make a partial postback on updatepanel UpdatePanelName. I hope this helps!
I had a similar requirement and used updatepanels inside a main updatepanel.

Thanks for your answers.

I've tried the UpdatePanel.Update() method, but still refreshing the entire page.

I've tried too somethinglike this:

<cc1:UpdatePanel ID="PanelFotoGrande" runat="server" Mode="Conditional"><ContentTemplate> ...Big Foto...</ContentTemplate><Triggers> <cc1:ControlEventTrigger ControlID="rptMiniaturas" EventName="ItemCommand" /></Triggers></cc1:UpdatePanel><cc1:UpdatePanel ID="PanelMiniaturas" runat="server" Mode="Conditional"><ContentTemplate> ...Thumbnails...</ContentTemplate></cc1:UpdatePanel>

With the same result. Finally, i've tried to group the two update panels inside other one. But still updating both updatepanels.

Maybe i have to disable the autopostbak fired by the button?? I don't know how..

Thanks a lot.

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...