CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/7/2006 1:42:31 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 35 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
gtjr921
Asp.Net User
dynamically create links in tree view3/7/2006 1:42:31 PM

0/0

I have a simple page that just checks a folder on my server for files and then populates the tree view with links to those files. All this works fine except when I click on the link that is created nothing happens. I notice the in the javascript that is created by the tree view that the link has an s before the http like this

javascript:__doPostBack('Treeffl','shttp://www.mywebsite.com/folder/video/jj/filename.avi')

I think this may be the problem, but I didn't write that code, I believe the tree view did.

Here is my code

VB CODE
Partial Class FFL05
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim aLocalFiles As IO.FileInfo() = (New IO.DirectoryInfo("c:\foldername\").GetFiles("*.*"))
            For Each aFile As IO.FileInfo In aLocalFiles
                Treeffl.Nodes.Add(New TreeNode("http://www.mywebsite.com/" + aFile.Name))
            Next

        End If
    End Sub
-------------------------
ASPX Code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="FFL05.aspx.vb" Inherits="FFL05" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body bgcolor="Gray">
    <form id="form1" runat="server">
    <div>
       
  <asp:TreeView ID="Treeffl" runat="server">
        </asp:TreeView>
    </div>
    </form>
 </body>
</html>
---------------------------
 Code generated when I do a view source from IE

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><link href="App_Themes/Black/Default.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Black/frame.css" type="text/css" rel="stylesheet" /><title>
 Untitled Page
</title><style type="text/css">
 .Treeffl_0 { text-decoration:none; }

</style></head>
<body bgcolor="Gray">
    <form name="form1" method="post" action="ffl05.aspx" id="form1">
<div>
<input type="hidden" name="Treeffl_ExpandState" id="Treeffl_ExpandState" value="nnnnnnnnnnn" />
<input type="hidden" name="Treeffl_SelectedNode" id="Treeffl_SelectedNode" value="Treefflt9" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="Treeffl_PopulateLog" id="Treeffl_PopulateLog" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE5NDYyMjMzMDkPtrYCAgMPZBYCAgEPPCsACQIADxYGHg1OZXZlckV4cGFuZGVkZB4MU2VsZWN0ZWROb2RlBQlUcmVlZmZsdDkeCUxhc3RJbmRleAILZAgUKwAMBSwwOjAsMDoxLDA6MiwwOjMsMDo0LDA6NSwwOjYsMDo3LDA6OCwwOjksMDoxMBQrAAIWBB4EVGV4dAU9aHR0cDovL3d3dy5ncmFjZWJhcHRpc3Qtb2guY29tL2Jsb2cvdmlkZW8vZ3QvYXVzdGluaG9vcHMxLndtdh4IRXhwYW5kZWRnZBQrAAIWBB8DBTtodHRwOi8vd3d3LmdyYWNlYmFwdGlzdC1vaC5jb20vYmxvZy92aWRlby9ndC9DaXZpbFdhck1ULm1wMx8EZ2QUKwACFgQfAwU+aHR0cDovL3d3dy5ncmFjZWJhcHRpc3Qtb2guY29tL2Jsb2cvdmlkZW8vZ3QvRW1lcnNvbkJkYXkwNS53bXYfBGdkFCsAAhYEHwMFO2h0dHA6Ly93d3cuZ3JhY2ViYXB0aXN0LW9oLmNvbS9ibG9nL3ZpZGVvL2d0L2dtYXBhcnR5MDUud212HwRnZBQrAAIWBB8DBTdodHRwOi8vd3d3LmdyYWNlYmFwdGlzdC1vaC5jb20vYmxvZy92aWRlby9ndC9HdHNub3cud212HwRnZBQrAAIWBB8DBTxodHRwOi8vd3d3LmdyYWNlYmFwdGlzdC1vaC5jb20vYmxvZy92aWRlby9ndC9oYWxsaG9vcHMwNi53bXYfBGdkFCsAAhYEHwMFOmh0dHA6Ly93d3cuZ3JhY2ViYXB0aXN0LW9oLmNvbS9ibG9nL3ZpZGVvL2d0L2pvc2hob29wcy53bXYfBGdkFCsAAhYEHwMFOmh0dHA6Ly93d3cuZ3JhY2ViYXB0aXN0LW9oLmNvbS9ibG9nL3ZpZGVvL2d0L3RnaXZpbmcwNS53bXYfBGdkFCsAAhYEHwMFNmh0dHA6Ly93d3cuZ3JhY2ViYXB0aXN0LW9oLmNvbS9ibG9nL3ZpZGVvL2d0L1RodW1icy5kYh8EZ2QUKwACFgYfAwU2aHR0cDovL3d3dy5ncmFjZWJhcHRpc3Qtb2guY29tL2Jsb2cvdmlkZW8vZ3QvV29yazMud212HwRnHghTZWxlY3RlZGdkFCsAAhYGHwMFSmh0dHA6Ly93d3cuZ3JhY2ViYXB0aXN0LW9oLmNvbS9ibG9nL3ZpZGVvL2d0L19DYWJsZS0zMF8yMDA2MDMwNl8xNzI1MDcuYXZpHwRnHwVoZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFB1RyZWVmZmyvDiTFpgyfesbQqelRHOt9phOxdw==" />
</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="/blog/WebResource.axd?d=zT5UPTVomdHNXqvvArZaJQ2&amp;t=6327577gt283870832" type="text/javascript"></script>


<script src="/blog/WebResource.axd?d=rg47ayeTZvv_O1v1vB_JkQ2&amp;t=63275774gt83870832" type="text/javascript"></script>
<script>
<!--
    function TreeView_PopulateNodeDoCallBack(context,param) {
        WebForm_DoCallback(context.data.treeViewID,param,TreeView_ProcessNodeData,context,TreeView_ProcessNodeData,false);
    }
// -->
</script>

    <div>    
            
      

        <a href="#Treeffl_SkipLink"><img alt="Skip Navigation Links." src="/blog/WebResource.axd?d=5i_pmvP6pcH_35fSXiw7ZA2&amp;t=6327577487283870832" width="0" height="0" style="border-width:0px;" /></a><div id="Treeffl">
 <table cellpadding="0" cellspacing="0" style="border-width:0;">
  <tr>
   <td><img src="/blog/WebResource.axd?d=htrhV52Rl-7uCHRSarctWb1oXObOMSRMI6DsnLrO-mM1&amp;t=632757740283870832" alt="" /></td><td style="white-space:nowrap;"><a class="Treeffl_0" href="javascript:__doPostBack('Treeffl','shttp://www.mywebsite.com/blog/video/folder/austinhoops1.wmv')" onclick="TreeView_SelectNode(Treeffl_Data, this,'Treefflt0');" id="Treefflt0">http://www.mywebsite.com/blog/video/folder/austinhoops1.wmv</a></td>
  </tr>
 </table><table cellpadding="0" cellspacing="0" style="border-width:0;">
  <tr>
   <td><img src="/blog/WebResource.axd?d=kg4hV52Rl-7uCHRSarctWb1oXObOMSRMI6DsnLrO-mM1&amp;t=645757740283870832" alt="" /></td><td style="white-space:nowrap;"><a class="Treeffl_0" href="javascript:__doPostBack('Treeffl','shttp://www.mywebsite.com/blog/video/folder/CivilWarMT.mp3')" onclick="TreeView_SelectNode(Treeffl_Data, this,'Treefflt1');" id="Treefflt1">http://www.mywebsite.com/blog/video/folder/CivilWarMT.mp3</a></td>
  </tr>
 </table><table cellpadding="0" cellspacing="0" style="border-width:0;">
    </div>
   
<script type="text/javascript">
<!--
var Treeffl_ImageArray =  new Array('', '', '', '/blog/WebResource.axd?d=kg4hV52Rl-7uCHRSarctWffoXObOMSRMI6DsnLrO-mM1&t=632757740283870832', '/blog/WebResource.axd?d=kg4hV52Rl-7uCHRSarctWddJ7ctANeAj2XSmFGXu-ZI1&t=632757740283870832', '/blog/WebResource.axd?d=kg4hV52Rl-7uCHRSarctWcc1QsO5Jw7PCv9o_WOoT8w1&t=632757740283870832');
// -->
</script>

<div>

 <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wccDALumNDZDALJh+I9AqDRxd0JAsWnq8ILAumruPEDArfw+4oBAp2n0doPAoe/7tELAuPZ9IsLArTjwPkGAsz7mbYCAovg/o4FxzHZjc3PHmraCLBOt8Z+5+RCQ6k=" />
</div>

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

WebForm_InitCallback();var Treeffl_Data = new Object();
Treeffl_Data.images = Treeffl_ImageArray;
Treeffl_Data.collapseToolTip = "Collapse {0}";
Treeffl_Data.expandToolTip = "Expand {0}";
Treeffl_Data.expandState = theForm.elements['Treeffl_ExpandState'];
Treeffl_Data.selectedNodeID = theForm.elements['Treeffl_SelectedNode'];
for (var i=0;i<6;i++) {
var preLoad = new Image();
if (Treeffl_ImageArray[i].lenfolderh > 0)
preLoad.src = Treeffl_ImageArray[i];
}
Treeffl_Data.lastIndex = 11;
Treeffl_Data.populateLog = theForm.elements['Treeffl_PopulateLog'];
Treeffl_Data.treeViewID = 'Treeffl';
Treeffl_Data.name = 'Treeffl_Data';
// -->
</script>
</form>
 
</body>

</html>

 

gtjr921
Asp.Net User
Re: dynamically create links in tree view3/7/2006 2:09:16 PM

0/0

by the way I don't have to use tree view or any other particular control to accomplish this. I just want to have a page that dynamically generates links based on the files in a particular folder.
dannychen
Asp.Net User
Re: dynamically create links in tree view3/7/2006 5:41:57 PM

0/0

Your nodes don't have a navigateUrl specified so all they will do is postback.  In the constructor (#5) there's the option of setting a Navigate Url.  You should set this to the url to the file.
--
Danny


disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
gtjr921
Asp.Net User
Re: dynamically create links in tree view3/7/2006 6:48:48 PM

0/0

Can you please be more specific? I tried adding naviagate url like below to no avail

Dim
aLocalFiles As IO.FileInfo() = (New IO.DirectoryInfo("c:\aspnet20\").GetFiles("*.*"))

For Each aFile As IO.FileInfo In aLocalFiles

Treeffl.Nodes.Add (CType(New TreeNode("http://www.gracebaptist-oh.com/" + aFile.Name).NavigateUrl))

Next

dannychen
Asp.Net User
Re: dynamically create links in tree view3/7/2006 10:18:13 PM

0/0

There is more than one constructor for the TreeNode, you want the last one.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.treenode.treenode.aspx

--
Danny


disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
gtjr921
Asp.Net User
Re: dynamically create links in tree view3/7/2006 10:27:24 PM

0/0

I got it by doing this

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

If Not IsPostBack Then

Dim aLocalFiles As IO.FileInfo() = (New IO.DirectoryInfo("h:\foldername\st\video\gt").GetFiles("*.*"))

For Each aFile As IO.FileInfo In aLocalFiles

Dim NewNode As New TreeNode("http://www.website.com/folder/video/g/" + aFile.Name)

NewNode.NavigateUrl = ("http://www.website.com/folder/video/g/" + aFile.Name).ToString()

Treeffl.Nodes.Add(NewNode)

Next

End If

End Sub

6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Databases Authors: Thiru Thangarathinam, Pages: 504, Published: 2007
Effective GUI Test Automation: Developing an Automated GUI Testing Tool Authors: Kanglin Li, Mengqi Wu, Pages: 445, Published: 2004
ASP.NET 2.0 All-In-One Desk Reference For Dummies: all-in-one desk reference for dummies Authors: Doug Lowe, Jeff Cogswell, Ken Cox, Pages: 910, Published: 2006
M-health: Emerging Mobile Health Systems Authors: Robert S. H. Istepanian, Swamy Laxminarayan, Constantinos S. Pattichis, Pages: 623, Published: 2006
Software Engineering Environments: International Workshop on Environments, Chinon, France, September 18-20, 1989. Proceedings Authors: Fred Long, Pages: 313, Published: 1990
Intelligent Data Engineering and Automated Learning - IDEAL 2007: 8th International Conference, Birmingham, UK, December 16-19, 2007, Proceedings Authors: Hujun Yin, Pages: 1174, Published: 2008
Designing with Javascript: Creating Dynamic Web Pages Authors: Nick Heinle, Bill Peña, Pages: 216, Published: 2002
XSLT and XPath on the Edge: Unlimited Edition Authors: Jeni Tennison, Tennison, Pages: 648, Published: 2001
On the Move to Meaningful Internet Systems 2002: CoopIS, DOA, and ODBASE : Confederated International Conferences, CoopIS, DOA, and ODBASE 2002 : Proceedings Authors: R. Meersman, Zahir Tari, Pages: 1367, Published: 2002
The Internet Encyclopedia: A - F Authors: Hossein Bidgoli, Pages: 880, Published: 2004

Web:
dynamically create links in tree view - ASP.NET Forums Re: dynamically create links in tree view. 03-07-2006, 9:09 AM. Contact ... Re: dynamically create links in tree view. 03-07-2006, 12:41 PM. Contact ...
ActiveWidgets • Font colors • create dynamic treeview create dynamic treeview · javascript active widget textbox · multi insert delete update · javascript controls tab element · header web dynamic data ...
Dynamic TreeView Example : Tree « GUI Components « JavaScript DHTML examples/treeview/css/code.css">




Search This Site:










smcculloch's newsarticle module-centralization

always selects first from drop down list...?

asp.net isapi filter and joomla

getting random items from a collection

machine.config updating

need help with deleting a record

how to remove dulpicate records in array

dynamic web development

asp .net 1.1 and medium trust level

page body onload() problem

property. which one should i use?

asp .net visual basic 2003 printing

is there a tool for building skin files?

duplicate users online modules

best way to get userid guid in dnn3.0.x

what do i use instead of <%= ?

.net 2.0 encryption web.config/app.config options?

setting directory permissions

email problems (page runs slow, real slow)

passing sql parms

creating a web part for sharepoint

filesystem tutorial and examples

making my site live?

how to create .sql files?

new to dotlangauge

passing session("ftpfolder") to a class file

information of 2 different sites in one cookie

start up ie in kiosk mode

login/loout status ?

[wizard control] halting / preventing next step programmatically?

 
All Times Are GMT