ASP.NET
  Home arrow ASP.NET arrow Page 2 - IE Web Controls in VB.NET
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

IE Web Controls in VB.NET
By: Himanshu Dhami
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 25
    2003-02-25

    Table of Contents:
  • IE Web Controls in VB.NET
  • TreeView Control
  • TabStrip Control
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    IE Web Controls in VB.NET - TreeView Control


    (Page 2 of 4 )

    Once you've downloaded and installed IE Web Controls, create a new ASP.NET application and make sure the TreeView control is in the toolbox.

    Add the treeview control to your aspx form and in HTML view it will look something like this:

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="treeview.aspx.vb" Inherits="appname.treeview"%>
    <%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    <form id="Form2" method="post" runat="server">
         <iewc:treeview id="tvGroups" runat="server" Width="100%" BorderWidth="0px" Height="100%"></iewc:treeview>
    </form>


    So here a TreeView is created on your page and we will use "tvgroups" to refer it later.

    Now the code behind page (Treeview.aspx.vb):

    Imports Microsoft.Web.UI.WebControls
    Imports System.Data.SqlClient
    Public Class Treeview
        Inherits System.Web.UI.Page
        Protected WithEvents tvGroups As Microsoft.Web.UI.WebControls.TreeView
        Dim connString = "your connection string for database"
        Dim myConnection As New SqlConnection(connString)
        Dim dtid, dtname As String


    Here I am building the tree view with the values from the database, so now the remaining code is working with DataSets, DataRows and DataTables. If you know how to use them it’ll be easy for you, if not then there’s plenty of documentation about how to use them.

    The following code goes in the Page_Load event/method:

    If Not Page.IsPostBack Then
      Dim mysqladapter As New SqlDataAdapter()
      Dim mydataset As New DataSet()
      Dim pNode, pChild As TreeNode
      Dim dttable As DataTable
      Dim dtrow As DataRow
      Dim countrow As Integer
      Dim dtcolumn As DataColumn
      mysqladapter = New SqlDataAdapter("Fetch_departments", myConnection)
      mysqladapter.Fill(mydataset, "tbl_no_sales_days")
      Dim myDataView As DataView = New DataView(mydataset.Tables("tbl_no_sales_days"))
      myDataView.Sort = "departmentregionid"
      countrow = myDataView.Count
      pNode = New TreeNode()
      pNode.Text = "ALL DEPARTMENTS"
      pNode.NavigateUrl = ""
      tvGroups.Nodes.Add(pNode)
      For Each dttable In mydataset.Tables
        For Each dtrow In dttable.Rows
          dtid = dtrow(0)
          dtname = dtrow(1)
          pChild = New TreeNode()
          pChild.NavigateUrl = "http://www.oxx.no"
          pChild.Text = dtname
          pChild.ID = dtid
          pNode.Nodes.Add(pChild)
        Next
      Next
    End If


    In the code above "Fetch_departments" is a stored procedure which returns regions and departments.

    The output will be something like this:

    ALL DEPARTMENTS
    --REGION1
    -----DEPT1
    -----DEPT2
    -----DEPT3
    --REGION2
    -----DEPT1
    -----DEPT2
    -----DEPT3
    ...

    More ASP.NET Articles
    More By Himanshu Dhami


     

    ASP.NET ARTICLES

    - How Caching Means More Ca-ching, Part 2
    - How Caching Means More Ca-ching, Part 1
    - Reading a Delimited File Using ASP.Net and V...
    - What is .Net and Where is ASP.NET?
    - An Object Driven Interface with .Net
    - Create Your Own Guestbook In ASP.NET
    - HTTP File Download Without User Interaction ...
    - Dynamically Using Methods in ASP.NET
    - Changing the Page Size Interactively in a Da...
    - XML Serialization in ASP.NET
    - Using Objects in ASP.NET: Part 1/2
    - IE Web Controls in VB.NET
    - Class Frameworks in VB .NET
    - Cryptographic Objects in C#: Part 1
    - Sample Chapter: Pure ASP.Net







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway