reduce Categorie to 1 column

Last post 05-16-2008 4:18 AM by wannabeASPgeek. 8 replies.

Sort Posts:

  • reduce Categorie to 1 column

    05-14-2008, 9:28 AM

    Hello friens

    I try to move the categories list to the place holder in the norrow left panel of master file that panel used to hold Help and links.

    The format of the list came in with two columns where can I get to the code to reduce it to one column.

    Thanks     

  • Re: reduce Categorie to 1 column

    05-14-2008, 1:29 PM
    • Loading...
    • manorfarm
    • Joined on 02-21-2008, 10:45 PM
    • Posts 39

    Always back up first 

    You don't need to change the masterpage - go to the page you want to change lets say default.aspx and find this piece of code  <div id="announcements">

    Copy the following code directly above <div id="announcements"> -


      <div id="col_main_left">
         <uc1:CategoryBrowse ID="CategoryBrowser" runat="server" AutoNavigate="True"></uc1:CategoryBrowse>
                              </div>
      
    You should then end up with 2 category lists on you page  1 in the left panel and the original - you can then work out how to remove the original and its subcategories

    This will only show the top level categories

    if you want the subdategories to show just move all the code and the div tags into the col_main_left

    Hope this helps - you can then apply the same logic on other pages 

     

  • Re: reduce Categorie to 1 column

    05-14-2008, 7:55 PM

    I went back to change right and left things to direct the categories list back to what it was before because you said I don't need to change the master page right?   

    Then I went to default page and ad your code just above <div id="announcements"> just as followed: 

    .................................................................. 

    <div id="body">

    <div id="col_main_right">

    <uc1:FeaturedAd ID="FeaturedAd" runat="server" />

     

    </div>

    <div id="col_main_left">

    <h3 class="section">

    Browse For Boat Type</h3>

    <div class="content_right">

    <uc1:CategoryBrowse ID="CategoryBrowser" runat="server" AutoNavigate="True"></uc1:CategoryBrowse>

    </div>

    <div id="Div1">

    <uc1:CategoryBrowse ID="CategoryBrowse1" runat="server" AutoNavigate="True"></uc1:CategoryBrowse>

    </div>

    <div id="announcements">

    ................................................................................

    what effect the code did to the home page was it shift all categories in two columns view (still 2) on the the left narrow panel

    and add another set of identical categories list but a little larger font under the original one. what have I done wrong. what I try to do was,

    I try to fit the categories list in the narrow left panel in only one column view. I will find the way to put drop down list for the sub categories if it only list the top level one. 

    your help are always appreciated

    thanks 

       

  • Re: reduce Categorie to 1 column

    05-15-2008, 9:38 AM
    • Loading...
    • manorfarm
    • Joined on 02-21-2008, 10:45 PM
    • Posts 39

    <div id="body">

    <div id="col_main_right">

    <uc1:FeaturedAd ID="FeaturedAd" runat="server" />

     

    </div>

    <div id="col_main_left">

    <h3 class="section">

    Browse For Boat Type</h3>

    <div class="content_right">

    <uc1:CategoryBrowse ID="CategoryBrowser" runat="server" AutoNavigate="True"></uc1:CategoryBrowse>

    </div>

    <div id="Div1">

    <uc1:CategoryBrowse ID="CategoryBrowser" runat="server" AutoNavigate="True"></uc1:CategoryBrowse>

    </div>

    <div id="announcements">

    That should help tidy the page - now look at the controls section and review the code for categorybrowse  - everything that happens when calling this control is coded here.

    I have done this on my site, but i have no original code to compare it to and cannot remember exactly what i did

     

  • Re: reduce Categorie to 1 column

    05-15-2008, 10:22 AM
    • Loading...
    • manorfarm
    • Joined on 02-21-2008, 10:45 PM
    • Posts 39

    I remember what I did now

    Copy the categorybrowse.ascx file and paste it back to the control directory

    Rename it Topcategorybrowse.ascx

    change the ref in default.aspx to

    <%@ Register TagPrefix="uc1" TagName="CategoryBrowse" Src="Controls/TopCategoryBrowse.ascx" %>

    Make the following chages to TopCategorybrowse.ascx

    <%@ Control Language="VB" CodeFile="CategoryBrowse.ascx.vb" Inherits="TopCategoryBrowse_ascx" %>
    <asp:DataList ID="TopCategoryList" runat="server" DataSourceID="TopCategoriesDS"
    CssClass="category_browse" HorizontalAlign="Center" RepeatColumns="2" OnItemDataBound="TopCategoryList_ItemDataBound"
    OnItemCommand="TopCategoryList_ItemCommand">
    <ItemStyle VerticalAlign="Top" HorizontalAlign="Left"></ItemStyle>
    <ItemTemplate>
    <h4>
    <asp:LinkButton ID="TopCategoryButton" runat="server" Text='<%# Eval("Name") %>'
    CommandArgument='<%# Eval("Id") %>' />
    </h4>
    (<%# Eval("NumActiveAds") %>)
    <asp:Repeater ID="NestedSubCategoryRepeater" runat="server" DataSourceID="NestedCategoryDS"
    OnItemCommand="NestedSubCategoryRepeater_ItemCommand" OnItemDataBound="NestedSubCategoryRepeater_ItemDataBound">
    <HeaderTemplate>
    <ul>
    </HeaderTemplate>
    <ItemTemplate>
    <li>
    <asp:LinkButton ID="SubCategoryButton" runat="server" Text='<%# Eval("Name") %>'
    CommandArgument='<%# Eval("Id") %>' />
    (<%# Eval("NumActiveAds") %>) </li>
    <asp:Repeater ID="NestedSubCategoryRepeater2" runat="server" OnItemCommand="NestedSubCategoryRepeater_ItemCommand"
    DataSourceID="NestedCategoryDS2">
    <HeaderTemplate>
    <ul>
    </HeaderTemplate>
    <ItemTemplate>
    <li>
    <asp:LinkButton ID="SubCategoryButton2" runat="server" Text='<%# Eval("Name") %>'
    (<%# Eval("NumActiveAds") %>) </li>
    </ItemTemplate>
    <FooterTemplate>
    </ul>
    </FooterTemplate>
    </asp:Repeater>
    <asp:ObjectDataSource ID="NestedCategoryDS2" TypeName="AspNet.StarterKits.Classifieds.Web.CategoryCache"
    SelectMethod="GetBrowseCategoriesByParentId" runat="server">
    <SelectParameters>
    <asp:Parameter Type="Int32" Name="parentCategoryId"></asp:Parameter>
    </SelectParameters>
    </asp:ObjectDataSource>
    </ItemTemplate>
    <FooterTemplate>
    </ul></FooterTemplate>
    </asp:Repeater>
    <asp:ObjectDataSource ID="NestedCategoryDS" TypeName="AspNet.StarterKits.Classifieds.Web.CategoryCache"
    SelectMethod="GetBrowseCategoriesByParentId" runat="server">
    <SelectParameters>
    <asp:Parameter Type="Int32" Name="parentCategoryId"></asp:Parameter>
    </SelectParameters>
    </asp:ObjectDataSource>
    </ItemTemplate>
    </asp:DataList>
    <asp:ObjectDataSource ID="TopCategoriesDS" runat="server" TypeName="AspNet.StarterKits.Classifieds.Web.CategoryCache"
    SelectMethod="GetBrowseCategoriesByParentId">
    <SelectParameters>
    <asp:Parameter Type="Int32" DefaultValue="0" Name="parentCategoryId"></asp:Parameter>
    </SelectParameters>
    </asp:ObjectDataSource>

    These were the minimum number of changes required to get the changes I wanted - I am sure more code could be stripped out

  • Re: reduce Categorie to 1 column

    05-15-2008, 10:22 AM
    • Loading...
    • manorfarm
    • Joined on 02-21-2008, 10:45 PM
    • Posts 39

    I remember what I did now

    Copy the categorybrowse.ascx file and paste it back to the control directory

    Rename it Topcategorybrowse.ascx

    change the ref in default.aspx to

    <%@ Register TagPrefix="uc1" TagName="CategoryBrowse" Src="Controls/TopCategoryBrowse.ascx" %>

    Make the following chages to TopCategorybrowse.ascx

    <%@ Control Language="VB" CodeFile="CategoryBrowse.ascx.vb" Inherits="TopCategoryBrowse_ascx" %>
    <asp:DataList ID="TopCategoryList" runat="server" DataSourceID="TopCategoriesDS"
    CssClass="category_browse" HorizontalAlign="Center" RepeatColumns="2" OnItemDataBound="TopCategoryList_ItemDataBound"
    OnItemCommand="TopCategoryList_ItemCommand">
    <ItemStyle VerticalAlign="Top" HorizontalAlign="Left"></ItemStyle>
    <ItemTemplate>