-
updating db records with DetailsView bound to a tree view control- possible?
My scenarioo:
ASP.NET 2.0 , MS SQL Server 2005
I implemented an N-Level Tree View control that pulls the data from an SQL Server 2005 self-referencing table
that contains dynamically changing information about ~200 repots and the folders that are located in. The data in the table is
quasi-xml: all entities in the table have ItemID, child nodes [subfolders and reports names] have ParentID. The hierarchy is 5
levels deep.
I'm currently able to navigate on-demand thru the Tree View to the the Report Names that are the leaf nodes of the tree [they have
no children].
Next I'd like to implement Details View control bound to the Tree View in order to display one attribute of the report name -
its description that belongs to the same row in the SQL table as the report name itself. Also I'd like to be able to Edit the
Description of a report using the Detail View and Save the changes to the database. Before I delve further into the project, I'd
like ot ask you a high-level Question:
Q: Is it possible to do with Details View control bound to the Trtee Vew, Or not? If not, what other strategy can I use?
Thanks for your time,
Sergei Z
-
Heirachical Data display
Hi,
there is no possibility of binding details view to tree view.
it requires a data source,where treeview cant be a data source of details view...
if u want to display parent and child nodes level.....
i have one code which can help u out atleast til some point....
create a child parent relationship table in ur database....
in your stored procedure craete a temporary level...
and till ur dept level 5 just insert data into ur temp table....
in aspx code .. u need to just give margin for each and every level...
-
Welcome to DevX 
This treeview control does support binding. Hope that helps.
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
Shru and Hack,
thank you very much for your feedback!. Hack, thanks for welcomimg me to the forum!
I was able to resolve the problem by binding DetailsView to the Tree View by passing a parameter [a SeleltedNode Value in TreeView] to the DetailsView's SQLDataSource. The code is below: it was partly auto-generated after I configured SQLDataSOurce's query with a parameter coming from the other Control - TreeView.
---DETAILSVIEW
Code:
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
AutoGenerateEditButton="true">
<Fields>
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
</Fields>
</asp:DetailsView>
--SQLDATASOURCE
Code:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=LEON-VMSQLRPT;Initial Catalog=ReportServer;User ID=sa;Password=*******;"
SelectCommand="select [Name],description
FROM Catalog_RPT where cast(itemID as varchar(36)) = @ItemID"
UpdateCommand ="Update Catalog_RPT set Description = @Description Where cast(itemID as varchar(36)) = @ItemID">
<SelectParameters>
<asp:ControlParameter ControlID="TreeView1" Name="ItemID" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:ControlParameter ControlID="TreeView1" Name="ItemID" PropertyName="SelectedValue"
Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
Last edited by Hack; 07-18-2008 at 11:01 AM.
Reason: Added Code Tags
-
Thanks for coming back and posting your solution.
It could help others with the same, or similiar problem.
FYI: I edited your post and added [code]your code goes here[/code] tags around your code as it makes it a bit easier to read.
Thanks again.
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
Similar Threads
-
By alok.mahajan in forum ASP.NET
Replies: 5
Last Post: 06-02-2008, 02:38 AM
-
Replies: 0
Last Post: 06-24-2007, 11:51 PM
-
By badascan in forum VB Classic
Replies: 1
Last Post: 06-05-2007, 10:52 AM
-
By joe baxter in forum ASP.NET
Replies: 1
Last Post: 03-20-2006, 08:30 AM
-
By Bruce in forum ASP.NET
Replies: 0
Last Post: 08-16-2000, 11:13 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks