Showing posts with label installed. Show all posts
Showing posts with label installed. Show all posts

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

Trouble getting AJAX Extension 1.0 to work in VWD

I have installed the ASP.NET 2.0 AJAX Extension 1.0 on my computer. I tried creating an AJAX enabled web application in Visual Web Developer and the UpdatePanel controls along with all the other new AJAX keywords were not recognised even though the toolbox had been updated with the controls. I thought it might be my errors in the code, so I downloaded the sample code for the ToDo list application tutorial onwww.asp.net/ajax and I had the same problem.

That way I can be sure that it is my computer! I have Microsoft .NET Framework 1.0, 1.1, 2.0 and 3.0 installed. I have tried a reinstall of AJAX Extension 1.0 and have made sure that I have selected 'AJAX Enabled project' at the start up screen.

What is the problem?

Check out this link

http://asp.net/AJAX/Control-Toolkit/Live/Walkthrough/Setup.aspx



Sorry but that really wasn't that helpful! I just have the AJAX Extensions 1.0 NOT The Control Toolkit. I can't get the first bit to work so I can't use the toolkit anyway! When I tried installing the vsi file for the toolkit it didn't install the components properly.

What is the problem?


I think because you r using VWD, you will not be able to install vsi template.

and to use Microsoft AJAX Control you will have to download the toolkit

After downloading the toolkit just follow steps from above link

in "Configure Visual Studio 2005 and Visual Web Developer" section

I hope it helps.


I realised the problem.

I needed to install Service Pack 1 for VWD before it would fully recognise the AJAX Extensions. That solved it and I could then install the control toolkit

Trouble getting started, please help

Ok my problem is that I can't get a basic update panel to function correctly.

Here is what I did:

1) Downloaded and installed ASP.NET AJAX

2) Added a reference to System.Web.Extensions from myexisting ASP.NET application.

3) Copied all the web.config stuff I could find into my own web.config. I can post every web.config change if needed.

4) Created a new form.

5) Added a script manager, an update panel, a button and 2 labels.

6) I put 1 label into the update panel

7) I added an update panel trigger for an asyncpostbacktrigger for Button1 / Click.

8) I put some code in the page load and button click events to write out the current time to the labels.

Now when I run this, the button click doesn't just update the update panel, it does a full postback and page reload.

I tried creating an application from the start using the ajax template, and this exact same code works fine, but I seem unable to ADD the ajax functionality into my existing application.

Any ideas? Any way to narrow down the problem?

Here is the page output from my test page (the one the doesn't work):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>Untitled Page</title></head><body> <form name="form1" method="post" action="zajax.aspx" id="form1"><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTE4MDcxODkwD2QWAgIDD2QWBAIBDw8WAh4EVGV4dAUKNjozMzozNSBQTWRkAgcPZBYCZg9kFgICAQ8PFgIfAAUKNjozMzozNSBQTWRkZCbSNxjGnv0oo3s0JvUpWd1OHCwj" /><script src="/ScriptResource.axd?d=WWzAfBI_rdQxam3uQdNeBo6UjgPObu2SaxGwCsecklai8gu7WtIhUsofOWAHTAlPUibAvbb2N8dnhGH5Tlo9L6EdZbxe5NvYcX9AZQ-T0Do1&t=633058483670203504" type="text/javascript"></script> <div>  <span id="Label2">6:33:35 PM</span> <input type="submit" name="Button1" value="Button" id="Button1" />   <div id="UpdatePanel1"> <span id="Label1">6:33:35 PM</span> </div> </div> <script type="text/javascript"><!--Sys.Application.initialize();// --></script></form></body></html>

Now when I put the same server side code into an AJAX Template Application, it DOES work, and the page output contains a lot more stuff:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>Untitled Page</title></head><body> <form name="form1" method="post" action="default2.aspx" id="form1"><div><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTE4MDcxODkwD2QWAgIDD2QWAgIBDw8WAh4EVGV4dAUKNjozNToyNCBQTWRkZNZhuPWbMGlct/IbEepy3VFq4PPN" /></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="/WebResource.axd?d=IGbOu8tbXSYcXb22j2-mVA2&t=632993516188917664" type="text/javascript"></script><script src="/ScriptResource.axd?d=qjtDxogNeiSUKOtmty-j9LOFc00mMzNwj-wep6XL5baMU0VZUYW2HyaCCOXHOI2_3oSO_YCxqyX9CyTLuDTKeyhteOcDGwPlwaJ4N4EDBr41&t=633058483670203504" type="text/javascript"></script><script src="/ScriptResource.axd?d=qjtDxogNeiSUKOtmty-j9LOFc00mMzNwj-wep6XL5baMU0VZUYW2HyaCCOXHOI2_3oSO_YCxqyX9CyTLuDTKe9Vuooudj_iJ62Khwrpdqfc1&t=633058483670203504" type="text/javascript"></script>  <span id="Label2">6:35:24 PM</span> <input type="submit" name="Button1" value="Button" id="Button1" /> <script type="text/javascript">//<![CDATA[Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], ['Button1'], [], 90);//]]></script>   <div id="UpdatePanel1"> <span id="Label1">Label</span> </div> <div><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLAh/rhCAKM54rGBo/RxSYDefM+QwfmqDXaIMTc/6Ya" /></div><script type="text/javascript"><!--Sys.Application.initialize();// --></script></form></body></html>

My ASPX page has this:

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" CodeBehind="zAjax.aspx.vb" Inherits=".zAjax" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server">  <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>   <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel> </form></body></html>

Seems like you are messed up with the web.config file. Take a new AJAX Project and copy the web.config file to replace your existing web.config. If you have made any custom changes to your original web.config file, make them in the new.

Are you adding any AJAX related dll's to the \bin folder? You dont need to add them coz with ASP.NET AJAX 1.0 all the assemblies are installed into GAC.

Thanks


You might also find this handy...I know I did when I found the whole thing was reloading/rebuilding (dynamic controls etc)...it should allow you to establish the type of postback you are getting...

' asynchronous postback?
If MyScriptManager.IsInAsyncPostBack =FalseThen' do some stuffEndIf