|
 | |
 | Bill2clone | Asp.Net User |
| Re: Microsoft.Web.UI.WebControls Treeview | 10/2/2003 3:14:27 PM |
0 |   |
| |
 | fralar | Asp.Net User |
| Re: Microsoft.Web.UI.WebControls Treeview | 10/2/2003 3:26:48 PM |
0 |   |
|
Thanks for your answer
I send you the code.
<%@ Page Language="VB" %>
<%@ Register TagPrefix="portal" TagName="Banner" Src="~/DesktopPortalBanner.ascx" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="ASPNetPortal" %>
<%@ Register TagPrefix="bfc" Namespace="Bfc.Controls" Assembly="bfcControls"%>
<%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Private moduleId As Integer = 0
Private tabId As Integer = 0
Private tabIndex As Integer = 0
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
If Not IsPostBack Then
dim a as string ="0"
dim ServerName As String = "LocalHost"
Dim DataBaseName As String = "Portal"
Dim UserId As String = "sa"
Dim PassWord As String = "sa"
Dim StoredP As String = "select * from sherlockrelation where LevelId=1 order by levelid, ParentId"
Dim SqlType As String = "Text"
Dim Nsql As New SqlConnection
Dim CmLevelId As SqlDataAdapter
Dim CmParentId As SqlDataAdapter
Dim CmChildId As SqlDataAdapter
Dim CmItemId as SqlDataAdapter
Dim CmItemIcon as SqlDataAdapter
Dim ds As DataSet
Dim Ncmd As New Sqlcommand
Dim RowItem As DataRow
Dim _NewConnection as string = "server=" & ServerName & ";uid=" & UserId & ";pwd=" & PassWord & ";database=" & DataBaseName
Nsql= new SqlConnection(_NewConnection)
Ncmd= new SqlCommand(StoredP,Nsql)
ds = New DataSet
if SqlType="Text"
Ncmd.commandType=commandType.text
else
Ncmd.commandType=Commandtype.StoredProcedure
end if
Try
Nsql.Open()
Catch ex As Exception
a ="1"
Finally
if a="0"
Try
CmLevelId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "LevelId")
CmParentId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ParentId")
CmChildId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ChildId")
CmItemId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ItemId")
CmItemIcon = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ItemIcon")
Catch ex As Exception
end try
end if
End Try
'Populate the TreeView from the DataSet.
For Each RowItem In ds.Tables("ItemId").Rows
dim nodeItem = New TreeNode()
nodeItem.Text = RowItem("ItemId")
nodeItem.NodeData = RowItem("ChildId")
if RowItem("ParentId")>0 then
nodeItem.Expandable = ExpandableValue.always
End if
nodeItem.ImageUrl = "/webctrl_client/1_0/images/" & RowItem("ItemIcon")
'NodeItem.OnExpand=TvExpand
TvSherlock.Nodes.Add(nodeItem)
Next
'Clean up.
ds.Dispose()
Nsql.Close()
Nsql.Dispose()
End If
End Sub
' Sub for expand item on the treeView
Private Sub TvExpand(ByVal sender As Object, ByVal e As Microsoft.Web.UI.WebControls.TreeViewClickEventArgs)
dim a as string ="0"
dim nodeItem as TreeNode
nodeItem = sender.nodes(e.Node.ToString)
dim ParentSearch as integer = CInt(nodeItem.NodeData)
dim TvIndex as integer = CInt(NodeItem.GetNodeIndex)
dim ServerName As String = "LocalHost"
Dim DataBaseName As String = "Portal"
Dim UserId As String = "sa"
Dim PassWord As String = "sa"
Dim StoredP As String = "select * from sherlockrelation where parentId=" & ParentSearch & " order by levelid, ParentId"
Dim SqlType As String = "Text"
Dim Nsql As New SqlConnection
Dim CmLevelId As SqlDataAdapter
Dim CmParentId As SqlDataAdapter
Dim CmChildId As SqlDataAdapter
Dim CmItemId as SqlDataAdapter
Dim CmItemIcon as SqlDataAdapter
Dim ds As DataSet
Dim Ncmd As New Sqlcommand
Dim RowItem As DataRow
Dim _NewConnection as string = "server=" & ServerName & ";uid=" & UserId & ";pwd=" & PassWord & ";database=" & DataBaseName
Nsql= new SqlConnection(_NewConnection)
Ncmd= new SqlCommand(StoredP,Nsql)
ds = New DataSet
if SqlType="Text"
Ncmd.commandType=commandType.text
else
Ncmd.commandType=Commandtype.StoredProcedure
end if
Try
Nsql.Open()
Catch ex As Exception
a ="1"
Finally
if a="0"
Try
CmLevelId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "LevelId")
CmParentId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ParentId")
CmChildId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ChildId")
CmItemId = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ItemId")
CmItemIcon = New SqlDataAdapter(StoredP, Nsql)
CmLevelId.Fill(ds, "ItemIcon")
Catch ex As Exception
end try
end if
End Try
'Populate the TreeView from the DataSet.
For Each RowItem In ds.Tables("ItemId").Rows
nodeItem = New TreeNode()
nodeItem.Text = RowItem("ItemId")
nodeItem.NodeData = RowItem("ChildId")
nodeItem.Expandable = ExpandableValue.CheckOnce
nodeItem.ImageUrl = "/webctrl_client/1_0/images/" & RowItem("ItemIcon")
'NodeItem.OnExpand=TvExpand(nodeItem.NodeDtata)
TvSherlock.Nodes.Addat(TvIndex+1, NodeItem)
Next
'Clean up.
ds.Dispose()
Nsql.Close()
Nsql.Dispose()
End Sub
</script>
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../portal.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<Form runat="server">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td height="100%" class="ItemTitle">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="100%" class="ItemTitle">
<ie:TreeView id="TvSherlock" style="Z-INDEX: 101; LEFT: 13px; POSITION: absolute; TOP: 13px" runat="server" SystemImagesPath="/webctrl_client/1_0/treeimages/" OnExpand="TvExpand" autopostback="True" >
</ie:TreeView>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html> |
|
| |
Free Download:
Books: ASP.NET Unleashed Authors: Stephen Walther, Pages: 1459, Published: 2003 Advanced SharePoint Services Solutions: Advanced Sharepoint Services Solutions Authors: Scot Hillier, Pages: 365, Published: 2005 .NET programming 10-minute solutions: 10-Minute Solutions Authors: A. Russell Jones, Mike Gunderloy, Pages: 433, Published: 2003 ASP.NET Developer's Cookbook Authors: Steven A. Smith, Rob Howard, ASP Alliance, Pages: 456, Published: 2003 ASP.NET 2.0 Black Book Authors: Dreamtech Software, Charul Shukla, Dreamtech Software India, Anil Kumar Barnwal, Pages: 1167, Published: 2006 Sams Teach Yourself More Visual Basic .NET in 21 Days Authors: Lowell Mauer, Pages: 579, Published: 2002 ASP.NET by example Authors: Steven A. Smith, Pages: 527, Published: 2002 Pro C# 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1370, Published: 2007 Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006 Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008 Web:Microsoft.Web.UI.WebControls.Design Assembly Reference Provides the designer class for Microsoft.Web.UI.WebControls.TreeView. Note All of the classes within the Microsoft.Web.UI.WebControls. ... About the TreeView WebControl As with the other Microsoft Internet Explorer WebControls, the TreeView control .... WebControls" Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, ... ASP.NET Microsoft.Web.UI.WebControls Treeview Problem - ASP.NET Forums In these web applications we are using the treeview control which is part of the Microsoft.Web.UI.WebControls package. ... Programmatically Loading, Expanding and Searching TreeView May 16, 2002 ... It is obvious that writers of Microsoft.Web.UI.WebControls.TreeView were more concerned with design time features of this control than with ... Microsoft.Web.UI.Webcontrol Treeview Talk about Microsoft.Web.UI.Webcontrol Treeview. ... Reload this Page Microsoft. Web.UI.Webcontrol Treeview ... Microsoft.Web.UI.WebControls - TreeView is ambiguous - ASP.NET Forums Hi, I've a problem, from some day my web site doesn't work. I use Microsoft.Web. UI.WebControls.dll (v.1.0.2.226) for building a treeview, ... Deriving from Microsoft.Web.UI.WebControls.TreeView - CodeGuru Forums public class TimesheetTreeView : Microsoft.Web.UI.WebControls.TreeView { }. I add a TreeView control to my form and then edit then entry in ... Microsoft.Web.UI.WebControls.Treeview Data Population Hai all, I have a Microsoft.Web.UI.WebControls dll and trying to form a treeview . But instead .... Extending Microsoft.Web.UI.WebControls.TreeNode - MSDN Forums Extending Microsoft.Web.UI.WebControls.TreeNode. Answered Question This post has a code sample within it. Was this post helpful ? ... SelectedIndexChange event is not working in Microsoft.Web.UI ... I'm using a Microsoft.Web.UI.WebControls treeview in my web application (ASP.NET 1.1). It is working fine and i have built a tree with data. ... |
|
|
|