Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class UserControl_HomeBottombusiness
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try

            Dim str As String = "SELECT DISTINCT City_Name  FROM City_Master WHERE     (City_IsWareHouse = N'y') AND (City_IsDeleted = N'0')"
            Dim Con As New SqlConnection(ConfigurationManager.AppSettings("ConnectionString")) 'Define connection variable for connecting to SQL-Server
            Con.Open()                                             'Open the Connection
            Dim cmd As New SqlCommand(str, Con)                 'Define command variable to execute the query
            Dim dr As SqlDataReader                                'Define DataReader variable for storing the output of the query
            dr = cmd.ExecuteReader
            Dim i = 0
            Dim t As String = ""
            If dr.HasRows Then
                Do While dr.Read

                    t = dr.Item("City_Name") & " | " & t

                Loop
            End If
            't = t.Remove(t.Length - 3, t.Length)
            Dim temp As String = t.Remove(t.Length - 3)
            Label1.Text = temp
            str = "SELECT     Category_Name, Category_PageLink    FROM Category_Master  WHERE     Category_ParentId = N'Root Category' OR   Category_ParentId = N'Root Categ' and category_isdeleted='0'"
            dr.Close()
            dr = Nothing
            Con.Close()
            Con.Open()                                             'Open the Connection"
            Dim cmd1 As New SqlCommand(str, Con)                 'Define command variable to execute the query
            Dim dr1 As SqlDataReader                                'Define DataReader variable for storing the output of the query
            dr1 = cmd1.ExecuteReader
            i = 0
            'Dim t As String = ""
            If dr1.HasRows Then

                'DataList1.DataSource = dr
                'DataList1.DataBind()

                Do While dr1.Read
                    Dim lnkhypen As New HyperLink
                    Dim lbllnk As New Label
                    lnkhypen.ID = "Hypen" & i
                    lbllnk.ID = "Label" & i
                    lbllnk.Text = " | "
                    lnkhypen.Text = dr1.Item("Category_Name")
                    lnkhypen.NavigateUrl = dr1.Item("Category_PageLink").ToString.Trim

                    ' lnkhypen.Style.Add("Font-Underline", "False")
                    lnkhypen.ForeColor = Drawing.Color.Black
                    'lnkhypen.Font.Underline = False
                    'lnkhypen.Style.Add("style", "color: black")
                    ' lnkhypen.Style.Add("ForeColor", "Black")
                    'ForeColor = "Black"
                    PlaceHolder1.Controls.Add(lnkhypen)
                    PlaceHolder1.Controls.Add(lbllnk)

                    '    't = dr.Item("City_Name") & " | " & t
                    i = i + 1     '    datalist1.

                Loop

                'PlaceHolder1.Controls.RemoveAt()
            End If
            '  HyperLink1.NavigateUrl = "about.aspx"
            't = t.Remove(t.Length - 3, t.Length)
            'Dim temp As String = t.Remove(t.Length - 3)
            dr1.Close()
            dr1 = Nothing
            'Label1.Text = temp
            Con.Close()
            Con.Dispose()
            cmd.Dispose()
            dr = Nothing
        Catch ex As Exception

        End Try


    End Sub
End Class
