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: 11/2/2005 7:38:01 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 28 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
Cricketer
Asp.Net User
Linking Formview to Treeviw11/2/2005 7:38:01 AM

0/0

Hi,

Can someone help please. I've got a Treeview, VS2005, to show hierarchical information and I want to show details of a selected record in a Formview. I can't get the code for the onselectednode event to work. It should be easy but I just can't get it. Anyone else been here please?
dannychen
Asp.Net User
Re: Linking Formview to Treeviw11/2/2005 4:24:22 PM

0/0

TreeView has a "SelectedNodeChanged" event that you can attach to.  You should be able to modify the FormView's datasource filtering inside of that event.  Call DataBind on the FormView and it can work.  If you share some of the code you are using, perhaps I can offer less general advice.  I have done this many times in various ways.
--
Danny
disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
Cricketer
Asp.Net User
Re: Linking Formview to Treeviw11/3/2005 4:52:07 PM

0/0

Danny,

Thanks very much for taking the time to answer.

Relevant snippets of code I have are:-
 
Sub TreeView_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs)
        SqlDataSource1.SelectParameters("IntRiskID").DefaultValue = LinksTreeView.SelectedNode.Value
End Sub


<asp:TreeView id="LinksTreeView"
       
        ForeColor="Blue"
        EnableClientScript="true"
        PopulateNodesFromClient="true" 
        OnTreeNodePopulate="PopulateNode"
        OnSelectedNodeChanged = "TreeView_SelectedNodeChanged"

        runat="server" Height="8px">
        
        <Nodes>
       
          <asp:TreeNode Text="Fleet-Wide Systems"
            SelectAction="Expand"
            ImageUrl = "Treeimages/BUnit.gif"
            PopulateOnDemand="True" Value="Fleet-Wide Systems"/>
           
        </Nodes>
       
      </asp:TreeView>


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DLORiskWebConnectionString2 %>"
                            SelectCommand="SELECT * FROM [tblRisk] WHERE ([strBU] = @strBU)">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="Fleet-Wide Systems" Name="strBU" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>

Any guidance and I would be very grateful

Calvin

dannychen
Asp.Net User
Re: Linking Formview to Treeviw11/4/2005 4:07:31 PM

0/0

The problem is this line:

SelectAction="Expand"

Since you've set it to expand, it's going to expand/collapse the node (all client side) from this action.  What you probably want is: "SelectExpand" instead so that it'll expand the node as well as select it.  Change it to either "Select" or "SelectExpand" and you'll start seeing your event fire.
--
Danny
disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
Cricketer
Asp.Net User
Re: Linking Formview to Treeviw11/4/2005 8:36:50 PM

0/0

Danny,

Thanks again. I'm afraid your suggestion made no improvement.

I've now placed a Label on the form and this takes the intRiskID value returned from the node and displays it correctly. It's the line after that that returns the error "Object reference not set to an instance of an object"

Sub TreeView_SelectedNodeChanged(ByVal sender As Object, ByVal e As EventArgs)

Label1.Text = LinksTreeView.SelectedNode.Value.ToString()

SqlDataSource1.SelectParameters("IntRiskID").DefaultValue = LinksTreeView.SelectedNode.Value.ToString()

FormView1.DataBind()

End Sub

--
Calvin

dannychen
Asp.Net User
Re: Linking Formview to Treeviw11/5/2005 12:06:14 AM

0/0

Calvin,
  It doens't look like "IntRiskID" is a parameter on your SqlDataSource.  That would cause your Null Ref exception.  You would need to add it as an "asp:Parameter" in your sql datasource declaration and modify your SELECT query to consume this value.  How do you want to use this ID value?
--
Danny
disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
Cricketer
Asp.Net User
Re: Linking Formview to Treeviw11/5/2005 1:17:00 PM

0/0

Danny,

Problem now solved. Thank you for your advice and patience.

As you have probably gathered I'm new to asp dot net 2.0; quite new to dot net actually.

The mistake I made was to have created the Formview first so that when I bound it to the data source the treeview wasn't there to be linked to as a parameter. After your last post I decided to delete the formview altogether and start afresh and with your advice looked out for the parameter part. Fantastic to be able to link in this way. I'm so used to having to do everything in code hence my looking for the problem in the wrong place.

I have been using treeviews in VB for quite a long time and have enjoyed the functioality that this control has supplied. Up until VS 2005 I haven't really been able to replicate this functionality in a web environment. This has now changed and I thing VS 2005 is absolutely fantastic and really exciting.

Thanks once again for your time.

Calvin

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


Free Download:

Books:
Professional C# 2008 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Pages: 1782, Published: 2008
Beginning ASP.NET 2.0 Authors: Chris Hart, John Kauffman, Chris Ullman, David Sussman, Pages: 759, Published: 2005
Professional ASP.NET 2.0 Databases Authors: Thiru Thangarathinam, Pages: 504, Published: 2007
Professional VB 2005 Authors: Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Rama Ramachandran, Kent Sharkey, Bill Sheldon, Pages: 1066, Published: 2006
Professional C# 2005 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones, Pages: 1540, Published: 2006
Professional C# 2005 with .NET 3.0 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Pages: 1748, Published: 2007

Web:
Linking Formview to Treeviw - ASP.NET Forums Re: Linking Formview to Treeviw. 11-02-2005, 12:24 PM. Contact ... Re: Linking Formview to Treeviw. 11-03-2005, 12:52 PM. Contact ...
radUpload with submit inside formview - telerik Forum I have a radUpload with submit within a formview itemtemplate. ... The image showes a broken link but when i look at the properties it ...
FormView GridView connection My goal is to attach a FormView control to a GridView control such that clicking the Select link on a record in the GridView will cause that ...
MFC and FormView - C++ Now I want to add a new item on the TreeView to display on the FormView ... Re: MFC and FormView. May 18th, 2008. Ancient Dragon's link is ...
Flex search module - ng.asp-net-forum.portal_starter_kit - Fix ... error on events & node index select · linking formview to treeviw · can you load a certain profile · has anyone ever got the treeview control to word wrap ...
MSDN Visual C# IDE Formview problem in Visual Studio 2008 Firstly the OP's question related to the fact that the FormView, ... I should also mention that I commented out your link tag for your CSS file. ...
Master Pages, Themes and Navigation Controls - ASP.NET Forums Linking Formview to Treeviw by Cricketer. Not Resolved. Re: Linking Formview. ... Problems with Treeview control by rldupo. Not Resolved. Re: Problems with. ...
FormView+RadGrid+Related - telerik Forum TreeView for WPF ... Could you give me a link for a similar example? ... If I have to use a FormView, how can I link it to other related ...
itemtemplate Resources | TechRepublic I have a treeview menu in aspnet wich gets populated from my sqlDB. everything ... NET 2.0 data controls continues this week with the FormView control. ...
.NET ASP Page 13 - Bytes Site Map GridView insert button · asp.net + process output · Link FormView to GridView .... treeview in master page loses state when new page is selected ...




Search This Site:










links and redirection

cloning page "copy content" dnn 3.0.8

setup custom providers (membership and roles) in vb

building an asp.net website and assigning roles on godaddy.com

report addin for vswd 2008

strong naming?

free multi page text - html module

old html

changing colors

msbuid using msbuild community tasks : - zip task fails

passing user credentials from sharepoint 2003 site to asp.net web application

any documentation on dnn2 pa installer?

help me out in portal starter kit 1.1

why my images don't copy to images directory in core ?

control within master page gets "does not exist in the current context"

secure the password while being transmitted to the server

securequerystring assistance please (vb)

membersdatacomponenttableadapters namespace and membersdataadapter class explanation?

control not recognized

does ms sql server 7.0 work with dnn 3.0.10

need help with sign in screen

trying to get the user.identity.name in the master page code

using different login forms to authenticate different sections of a site

help! i can not add a new item to ibuyspy

findcontrol masterpage (possible brain-fart warning)

make linkbutton act like submit key

how to build a tree type guest book?

referencing controls on nested master pages

error on install

designer vs.net question

 
All Times Are GMT