Imports System
Imports System.Data
Imports System.Data.SqlClient
Partial Class category1_Interiors_Furnishings
    Inherits System.Web.UI.Page
    Dim catid As String
    Dim con1 As New SqlConnection
    Dim DRow() As DataRow
    Dim dtCategoryDistinct As DataTable
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If IsNothing(CatDistinct) Then
                GetCatDistinct()
            End If
            'Session("CategoryDistinct") = ReturnDataTable("Select * from CategoryDistinct")
            dtCategoryDistinct = CatDistinct
            con1.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
            Dim Strr As String
            Dim lnk As New LinkButton
            Strr = "select Category_Kid from CategoryDistinct where Category_ParentId ='0000228' order by category_name asc"
            If con1.State = Data.ConnectionState.Open Then
                con1.Close()
            End If
            Session("MainCat") = "0000228"
            con1.Open()
            Dim da As New SqlDataAdapter(Strr, con1)
            Dim ds1 As New DataSet
            da.Fill(ds1)
            Dim i As Integer = 1
            Dim j As Integer = 0
            For j = 0 To ds1.Tables(0).Rows.Count - 1
                catid = ds1.Tables(0).Rows(j).Item(0).ToString
                'Dim gv As New GridView

                'gv.ID = "gv" & i
                If j = 0 Then
                    bottomCategory(catid, gv1)
                End If
                If j = 1 Then

                    bottomCategory(catid, gv2)
                End If
                If j = 2 Then

                    bottomCategory(catid, gv3)
                End If
                If j = 3 Then

                    bottomCategory(catid, gv4)
                End If
                If j = 4 Then

                    bottomCategory(catid, gv5)
                End If
                If j = 5 Then
                    bottomCategory(catid, gv6)
                End If
                If j = 6 Then

                    bottomCategory(catid, gv7)
                End If
                If j = 7 Then

                    bottomCategory(catid, gv8)
                End If
                If j = 8 Then

                    bottomCategory(catid, gv9)
                End If
                If j = 9 Then

                    bottomCategory(catid, gv10)
                End If
                If j = 10 Then

                    bottomCategory(catid, gv11)
                End If
                If j = 11 Then

                    bottomCategory(catid, gv12)
                End If
                If j = 12 Then

                    bottomCategory(catid, gv13)
                End If
                If j = 13 Then

                    bottomCategory(catid, gv14)
                End If
                If j = 14 Then

                    bottomCategory(catid, gv15)
                End If
                If j = 15 Then

                    bottomCategory(catid, gv16)
                End If
                If j = 16 Then

                    bottomCategory(catid, gv17)
                End If


            Next
            ds1.Clear()
            con1.Close()

        End If
    End Sub

    'Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    '    Dim lb As LinkButton = CType(sender, LinkButton)
    '    Response.Redirect("../SearchProduct.aspx?Product_Id=" & lb.CommandArgument.Trim)
    'End Sub

    Protected Sub gv1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv10_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv10.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv11_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv11.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv12_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv12.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv13_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv13.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If
        End If
    End Sub

    Protected Sub gv14_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv14.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If
        End If
    End Sub

    Protected Sub gv15_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv15.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv16_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv16.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv17_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv17.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv3_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv3.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv4_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv4.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv5_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv5.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If


        End If
    End Sub

    Protected Sub gv6_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv6.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv7_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv7.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If


        End If
    End Sub

    Protected Sub gv8_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv8.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub

    Protected Sub gv9_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv9.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim strCatID As String
            strCatID = e.Row.Cells(1).Text
            'Dim boolCat As String
            DRow = dtCategoryDistinct.Select("Category_ParentId='" & strCatID & "'")
            '            boolCat = ReturnValue("Select CategoryName from CategoryDistinct where Category_ParentId='" & RemoveLiterals(strCatID) & "'")
            If DRow.Length > 0 Then
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = Server.HtmlEncode(ResolveUrl("~/s3/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx"))
            Else
                CType(e.Row.Cells(0).FindControl("LinkButton1"), HyperLink).NavigateUrl = ResolveUrl("~/category/" & EncodeURL(RemoveLiterals(strCatID)) & "/" & e.Row.Cells(3).Text & "/" & e.Row.Cells(2).Text & ".aspx")
            End If

        End If
    End Sub
End Class
