Showing posts with label ctp. Show all posts
Showing posts with label ctp. Show all posts

Wednesday, March 28, 2012

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 ExpandAll problem in beta 1, 2 with EnableClientScript="true"

I have a treeview problem inside an update panel since the first beta. In the last ctp no problem at all.

I have a treeview in the updatepanel with EnableClientScript="true". I have two button in the same update panel, that calls ExpandAll, and CollapseAll in server side click events. That works as expected: the updatepanel refresh the treeview with all node collapsed/expanded. However after then when I expand one node (that not cause a postback yet), and select a node (which now cause a postback), the nodes collapsed/expanded randomly after the updatepanel refresh.

It seems that the server side ExpandAll/CollapseAll could be out of the sync with the client side node expanding/collapsing.

It seems to me when EnableClientScript="true" for a treeview, the tree maintain the expanded/collapsed node in hidden fields, and that hidden field could be out of the sync after a server side ExpandAll/CollapseAll.

?

I write a small javascript function which collapse or expand all node on the cilent side for the treeview. Even the nodes collapsed state is persisted during postbacks/partial postbacks.

The bug still exist, but I will not use the server side ExpandAll in the future...

(just found by the docs that the treeview is not supported in the updatepanel officially, but many of us using it without main problems)

Monday, March 26, 2012

Treeview not working in Beta 1.0?

I have a treeview that used to work in CTP July version but stopped working after I installed the beta version.

The first problem: say I have node A and it has at least one child. If I expand node A (by clicking the + button) then click on the name of the node, it readds the children, effectively doubling the number of the nodes. I could continue adding the children of the nodes resulting is multiple children being added.

The second problem relates to the first one. Expand node A, expand node B, select node B then select one of node B's child. Somehow one of node A's child is expanded.

The third one: I can't expand more than two levels. Everytime I try to do it, this error message appears:

Line: 82
Error: 'undefined' is null or not an object

Looking at source, the line that breaks it is this:

table.insertAdjacentHTML("afterEnd", chunk);

All of the nodes have PopulateOnDemand = true. Am I doing something totally wrong or is it really a bug in the beta 1.0? Every other controls (including the ones from value pack) seems to work properly except this treeview. :(

For reference here's what I have on the aspx page:

<div class="BrowserTreeView">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TreeView ID="tvDirectory" runat="server" OnTreeNodePopulate="PopulateNode" OnPreRender="tvDirectory_PreRender" OnSelectedNodeChanged="tvDirectory_SelectedNodeChanged" SkinID="Explorer"></asp:TreeView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostbackTrigger ControlID="cmbComputer" EventName="SelectedIndexChanged"></asp:AsyncPostbackTrigger>
<asp:AsyncPostbackTrigger ControlID="cmdOpen" EventName="Click"></asp:AsyncPostbackTrigger>
</Triggers>
</asp:UpdatePanel>
</div>

Please see these two articles:

- What's up with UpdatePanels and how come nothing works? (http://forums.asp.net/thread/1440058.aspx)
This is a higher level piece that explains how UpdatePanel changed from being automatic (and broken) in the CTP to the new functionality in the beta.

- HOWTO: Write controls compatible with UpdatePanel without linking to the ASP.NET AJAX DLL (http://forums.asp.net/thread/1445844.aspx)
This article goes in depth on how to use the new registration APIs on ScriptManager, but without linking to the Atlas assembly.

Thanks,

Eilon


Thanks. I didn't know that treeview is not supported yet.

Treeview TreeNodePopulate event.

I have recently installed the AJAX Beta 2 Extensions having used the ATLAS CTP. Having installed it I removed the DLLs from the Bin directory. On two of my pages in the application I am using the Treeview controls which only populate child nodes when each of the parent nodes are clicked on. On one page this the treeview works fine and populates on demand -

1protected void ATreeview_TreeNodePopulate(object sender, TreeNodeEventArgs e)
2 {
3switch (e.Node.Depth)
4 {
5case 0:
6break;
7case 1:
8 PopulateTreeview(e.Node);
9break;
10 }
11 }


The PopulateTreeview method takes the node that should be populated (which for e.g. is the Category) and creates all the product nodes. At the moment the TreenodePopulate event does nothing as I just want to see whether it actually raises the event. When I discovered the problem I took out all the code in this event. The code at the moment is as follows:

1protected void ATreeview_TreeNodePopulate(object sender, TreeNodeEventArgs e)
2 {
3 lblMessage.Text ="inside the treenode populate " + e.Node.Depth.ToString();
4 lblMessage.Visible =true;
5 }

When I debug this and expand a node I get the following error:


"Microsoft JScript runtime error: 'ctl00_ContentPlaceHolder1_tvUsersNoGroup_Data' is undefined" - I have no choice but to press Break and stop the application from running. In the IDE it just highlights this line TreeView_PopulateNode(ctl00_ContentPlaceHolder1_ATreeview_Data,1,ctl00_ContentPlaceHolder1_ATreeviewn1,ctl00_ContentPlaceHolder1_ATreeviewt1,null,'t','A Category','TopNode\\3016','f','','tf')

The design source code is as follows:

<asp:UpdatePanel ID="upUsers" runat="server"> <ContentTemplate> <table border="0" class="report_treeview"> <tr style="background-color:#6178BE; color: #FFFFFF;font-weight:bold; font-size:80%;text-align:center;"> <td>Users not in selected security group</td> <td><asp:DropDownList ID="ddSecurity" runat="server" AppendDataBoundItems="True" AutoPostBack="true" OnSelectedIndexChanged="ddSecurity_SelectedIndexChanged"> <asp:ListItem Selected="True" Text="Please select a security group" Value="0"></asp:ListItem> </asp:DropDownList></td> <td>Users in selected security group</td> </tr> <tr> <td style="vertical-align: top; width: 300px; text-align:left;"> <asp:TreeView id="ATreeview" runat="server" showlines="true" visible="false" OnTreeNodePopulate="tvUsersNoGroup_TreeNodePopulate"></asp:TreeView> </td> <td style="border-right: solid 1px #DDDDDD;border-left: solid 1px #DDDDDD;text-align:center;"> <asp:Button ID="btnAddUser" runat="server" Text=">>" CssClass="option_button" OnClick="btnAddUser_Click" ToolTip="Add selected users." /> <p /> <p /> <asp:Button ID="btnRemoveUser" runat="server" Text="<<" CssClass="option_button" OnClick="btnRemoveUser_Click" ToolTip="Remove selected users." /> </td> <td style="vertical-align: top; width: 300px; text-align:left;"> <asp:Label ID="lblStatus" runat="server"></asp:Label></td> </tr> </table> <p /><asp:Label ID="lblMessage" runat="server" CssClass="labelStatus"></asp:Label> </ContentTemplate> </asp:UpdatePanel>
Anyone else come across this problem? Why is my other page fine and this page is throwing this error?

I did have something like this. I would get an error on the source code saying it the object was undifined when it was trying to put the tooltip on the treenode. To 'fix' it I turned off script debuging on my browser, and it went away.

It may be something to try

Eric Wild


Thanks for the suggestion but I don't think that the problem can be solved by suppressing the errors from the browser.

What I would like to know is if other people have had the same problems as myself.

Is this a problem with the AJAX Beta 2? or my silly code?


I am encountering this issue right now and know it is related to the Visible="false" on the TreeView.

I'm using RC1 and have a Button in an UpdatePanel and a TreeView in another UpdatePanel. The TreeView has it's Visible property = "false".

When the Button is clicked, it sets TreeView's Visible="true".

At this point, if you try to Expand a TreeView Node, it will come back with that same debugging trap you encountered. I tried using Fiddler to see if it passed anything, but it didn't.

You could either keep the TreeView's Visible property = "true" from the start or set the TreeView's EnableClientScript="false".

I think this deserves a bump and hope someone can further explain why and perhaps offer a workaround because the concept that the TreeView only populates its expanding Node is very nice.

Nathan

Wednesday, March 21, 2012

trying to fix a messed up ATLAS install

I'm trying to fix a messed up ATLAS March CTP installation. Unfortunately I don't have with me the March CTP msi file, and the April CTP won't install / overwrite until I fix and then remove the March CTP. Could anyone point me to a fix, or provide the link to previous CTP releases?

I've tried searching but the March CTP just isn't to be found anymore.

TIA.

hello.

well, though it's not recommended, you can allways delete the files and remove the entries from the registry. this will let you install the new version. see if this link helps:

http://windowsxp.mvps.org/AddRemove.htm


Hi Luis,

Thanks for the response. While I was waiting for a response on the forums, I already tried deleting the directory & registry entries etc., but hasn't helped. The Cleanup Utility sure looks like it might work.

I'll try it out and post back if I encounter issues.


Luis,

Thanks a ton! That tool did the trickBig Smile [:D]