DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 20 Aug 2007 12:28:42 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Mel
          2    Ladislav Mrnka
          3    Mel
          4    Mel


Treeview - open node in new window   
I have a treeview control that contains a bunch of pdf filenames.  It
would like the files to open in a new window.  Can anyone assist me in
doing that?  The code I currently have is below:

Protected Sub tvDocs_SelectedNodeChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles tvDocs.SelectedNodeChanged
    Dim FilNam As String
    FilNam = Mid(tvDocs.SelectedNode.Parent.ValuePath,
InStr(tvDocs.SelectedNode.Parent.ValuePath, "Docs\") + Len("Docs\")) &
"\" & tvDocs.SelectedValue
    If InStr(UCase(tvDocs.SelectedValue), ".PDF") > 0 Then
Response.Redirect("~\1-New-Portal-Tree\" & FilNam)
End Sub


- Mel
(Visual Studio 2005, Asp.net 2.0, Visual Basic)
Date:Mon, 20 Aug 2007 12:28:42 -0700   Author:  

RE: Treeview - open node in new window   
Hi Mel,
do you really need to process node selection on server? TreeNode has 
NavigateUrl and Target properties properties. I assume you are binding 
TreeView to same data source. You can implement TreeNodeDataBound handler and 
set these properties for those nodes. Something like this

  protected void myTreeView_NodeDataBound(Object sender, TreeNodeEventArgs e)
  {
    // Implement some method to check if your node contains pdf document
    if(IsPDF(e.Node.Value))
    {
      // build your url to pdf document
      e.Node.NavigateUrl = BuildMyPath(e.Node.Parent.Value, e.Node.Value);
      e.Target = "_blank";
    }
  }

Regards,
Ladislav

"Mel" wrote:


> I have a treeview control that contains a bunch of pdf filenames.  It
> would like the files to open in a new window.  Can anyone assist me in
> doing that?  The code I currently have is below:
> 
> Protected Sub tvDocs_SelectedNodeChanged(ByVal sender As Object, ByVal
> e As System.EventArgs) Handles tvDocs.SelectedNodeChanged
>     Dim FilNam As String
>     FilNam = Mid(tvDocs.SelectedNode.Parent.ValuePath,
> InStr(tvDocs.SelectedNode.Parent.ValuePath, "Docs\") + Len("Docs\")) &
> "\" & tvDocs.SelectedValue
>     If InStr(UCase(tvDocs.SelectedValue), ".PDF") > 0 Then
> Response.Redirect("~\1-New-Portal-Tree\" & FilNam)
> End Sub
> 
> 
> - Mel
> (Visual Studio 2005, Asp.net 2.0, Visual Basic)
> 
> 
Date:Tue, 21 Aug 2007 00:10:02 -0700   Author:  

Re: Treeview - open node in new window   
On Aug 21, 2:10 am, Ladislav Mrnka
 wrote:

> Hi Mel,
> do you really need to process node selection on server? TreeNode has
> NavigateUrl and Target properties properties. I assume you are binding
> TreeView to same data source. You can implement TreeNodeDataBound handler and
> set these properties for those nodes. Something like this
>
>   protected void myTreeView_NodeDataBound(Object sender, TreeNodeEventArgs e)
>   {
>     // Implement some method to check if your node contains pdf document
>     if(IsPDF(e.Node.Value))
>     {
>       // build your url to pdf document
>       e.Node.NavigateUrl = BuildMyPath(e.Node.Parent.Value, e.Node.Value);
>       e.Target = "_blank";
>     }
>   }
>
> Regards,
> Ladislav
>
> "Mel" wrote:
> > I have a treeview control that contains a bunch of pdf filenames.  It
> > would like the files to open in a new window.  Can anyone assist me in
> > doing that?  The code I currently have is below:
>
> > Protected Sub tvDocs_SelectedNodeChanged(ByVal sender As Object, ByVal
> > e As System.EventArgs) Handles tvDocs.SelectedNodeChanged
> >     Dim FilNam As String
> >     FilNam = Mid(tvDocs.SelectedNode.Parent.ValuePath,
> > InStr(tvDocs.SelectedNode.Parent.ValuePath, "Docs\") + Len("Docs\")) &
> > "\" & tvDocs.SelectedValue
> >     If InStr(UCase(tvDocs.SelectedValue), ".PDF") > 0 Then
> > Response.Redirect("~\1-New-Portal-Tree\" & FilNam)
> > End Sub
>
> > - Mel
> > (Visual Studio 2005, Asp.net 2.0, Visual Basic)


When the user clicks on a particular .pdf filename I want to open it
for them.  Even though I have the target = "_blank" in the treeview
properties the file opens in the same browser window; I suspect
because I am using Redirect and maybe it's not capable of opening a
new window.  I was just wondering if there was another way to open the
file where it would open in a new window.  If anyone could provide a
detailed example I would really appreciate it.
Date:Tue, 21 Aug 2007 05:48:06 -0700   Author:  

Re: Treeview - open node in new window   
On Aug 21, 2:10 am, Ladislav Mrnka
 wrote:

> Hi Mel,
> do you really need to process node selection on server? TreeNode has
> NavigateUrl and Target properties properties. I assume you are binding
> TreeView to same data source. You can implement TreeNodeDataBound handler and
> set these properties for those nodes. Something like this
>
>   protected void myTreeView_NodeDataBound(Object sender, TreeNodeEventArgs e)
>   {
>     // Implement some method to check if your node contains pdf document
>     if(IsPDF(e.Node.Value))
>     {
>       // build your url to pdf document
>       e.Node.NavigateUrl = BuildMyPath(e.Node.Parent.Value, e.Node.Value);
>       e.Target = "_blank";
>     }
>   }
>
> Regards,
> Ladislav
>
> "Mel" wrote:
> > I have a treeview control that contains a bunch of pdf filenames.  It
> > would like the files to open in a new window.  Can anyone assist me in
> > doing that?  The code I currently have is below:
>
> > Protected Sub tvDocs_SelectedNodeChanged(ByVal sender As Object, ByVal
> > e As System.EventArgs) Handles tvDocs.SelectedNodeChanged
> >     Dim FilNam As String
> >     FilNam = Mid(tvDocs.SelectedNode.Parent.ValuePath,
> > InStr(tvDocs.SelectedNode.Parent.ValuePath, "Docs\") + Len("Docs\")) &
> > "\" & tvDocs.SelectedValue
> >     If InStr(UCase(tvDocs.SelectedValue), ".PDF") > 0 Then
> > Response.Redirect("~\1-New-Portal-Tree\" & FilNam)
> > End Sub
>
> > - Mel
> > (Visual Studio 2005, Asp.net 2.0, Visual Basic)


Thank you very much, I fixed it.  I set the Navigate Url to the path
and it worked.  I totally didn't realize that property even
existed ;)  My original code was setting the path upon the
SelectedNodeChanged event.  This way is much better.  I removed all of
the code from the SelectedNodeChanged and now just set the NavigateUrl
when I fill the tree.

Many thanks,
Mel
Date:Tue, 21 Aug 2007 08:44:20 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us