Nesting repeaters in .NET

Written by ProgrammerTutorials.com


Continued from page 1

Category.DataBind();
... other c# code ...


In your .aspx file you will have to changerepparttar DataSource to your child repeater (SubCategory) andrepparttar 131673 syntax in which you getrepparttar 131674 data.
The code below does so:

... other HTML code ...
<%@ Import Namespace="System.Data" %>

<asp:Repeater Runat="server" ID="Category">
<ItemTemplate>
    <a href="category.aspx?category=<%# DataBinder.Eval(Container.DataItem, " rel="nofollow"Category") %>"><%# DataBinder.Eval(Container.DataItem, "Category") %></a><br>

    <asp:Repeater Runat="server" ID="SubCategory" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("CategoryRelation")%>>
    <ItemTemplate>
        <a href="category.aspx?category=<%# DataBinder.Eval(Container.DataItem, " rel="nofollow"["SubCategory"]") %>"><%# DataBinder.Eval(Container.DataItem, "["SubCategory"]") %></a><br>
    </ItemTemplate>
    </asp:Repeater>
</ItemTemplate>

</asp:Repeater>
... other HTML code ...


If you do both changes,repparttar 131675 code should work fine.


Another interesting thing to note is how you can access a dataitem fromrepparttar 131676 parent (from within your child).
For example, we wishrepparttar 131677 link to includerepparttar 131678 Category also, even if it is a SubCategory.
Adjust your .aspx file torepparttar 131679 following:

... other HTML code ...
<%@ Import Namespace="System.Data" %>

<asp:Repeater Runat="server" ID="Category">
<ItemTemplate>
    <a href="category.aspx?category=<%# DataBinder.Eval(Container.DataItem, " rel="nofollow"Category") %>"><%# DataBinder.Eval(Container.DataItem, "Category") %></a><br>
    <asp:Repeater Runat="server" ID="SubCategory" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("CategoryRelation")%>>

    <ItemTemplate>
        <a href="category.aspx?category=<%# DataBinder.Eval(Container.DataItem, " rel="nofollow"["SubCategory"]") %>"><%# ((DataRow)Container.DataItem).GetParentRow("CategoryRelation")["Category"] %> - <%# DataBinder.Eval(Container.DataItem, "["SubCategory"]") %></a><br>
    </ItemTemplate>
    </asp:Repeater>
</ItemTemplate>

</asp:Repeater>
... other HTML code ...


This code is both easy to maintain, and performant.
The same principles count for other items bound to database data, likerepparttar 131680 DataGrid for example.



View our large database of webmaster and programming tutorials and articles.


How to get noticed on the Internet

Written by Ieuan Dolby


Continued from page 1

Large for profit websites can afford to hire web-orientated staff to control, advertise and spend time on boostingrepparttar rankings of their particular website. Single owner for profit websites can afford to pay marketing specialists and to buy keywords at exorbitant rates. The lone not-for-profit website owner can either spend all day and all week controlling and submitting his site torepparttar 131671 thousands of ever changing search engines and directories and suffer from a serious loss of updated content on his/her website or place emphasis on building up content and never have a visitor to his portal.

Many other factors go towards reducingrepparttar 131672 effectiveness ofrepparttar 131673 individual website than just search result rankings. Many single website owners operate outdated and very slow computers, use old or outdated software and only perform on odd occasions when not playing with their children or busy at work. Many other free info sites have found that subscribing to some lists to boost their rankings has in-fact reduced them to near invisibility. Google and now other search engines condemn sites for using link pages that they themselves do not agree with, so by simply subscribing or joining one of these sites Google may drop a future crawl ofrepparttar 131674 website involved. It is also impossible forrepparttar 131675 lone not-for-profit website to keep up with ever changing trends and policies. Where payment is made for a lifetimes inclusion in a search engine,repparttar 131676 next year may seerepparttar 131677 demise of this particular engine or its partnering up with another – thusrepparttar 131678 lifetimes inclusion becomes null and void and to prevent being dropped fromrepparttar 131679 listings another fee is required – readrepparttar 131680 small print!

Other means to increase visibility is often initiated by offering advertising space to companies like Google, Barnes and Noble or other directories or affiliates. This can result in a slight income for websites (The Seamania website made 40US dollars overrepparttar 131681 last three months) but never enough to afford placement on search engine results or to purchase keywords. It is also againstrepparttar 131682 grain for many free-info website owners to have to place advertising on their websites as not only is it taking up valuable space it detracts and reducesrepparttar 131683 free effectrepparttar 131684 content within. Furthermore should a website choose one companies advertising it may boost their rankings within one search engine but equally so reduce it in another’s e.g. allowing Google advertising space on an index page may increaserepparttar 131685 page rank in Google but seriously reduce it in Yahoos search results and possible exclusion from their Yahoo Directory.

Fromrepparttar 131686 point of view of an Internet User in search of free and not-for-profit biased information he/she does not want to see endless sites where a visa card is required to proceed further. It would be very nice to seerepparttar 131687 advancement of such directories like Zeal.com who divide their listings into those for profit and those who generally provide valuable and non-profit orientated formation. Naturallyrepparttar 131688 question arises as to how such a search engine would manage to coverrepparttar 131689 costs of these listings but generally withrepparttar 131690 amount of people available who regardrepparttar 131691 Internet as a toy and a hobby projects such as Editor of a category volunteers should not be hard to recruit. The other way would be to have search engines run and operated by governments like public libraries are or built and operated by universities as part of study programs – something practical for students to involve themselves with.

Directories abound whose content is managed by volunteers,repparttar 131692 Open Directory Project beingrepparttar 131693 most famous. But sites such as Seamania have found to their detriment that trying to get noticed in amongstrepparttar 131694 debris found in these directories is not easy. Seamania was originally listed as a Personal website inrepparttar 131695 boating category but over timerepparttar 131696 emphasis and content ofrepparttar 131697 website has evolved to become a general travel website. It has though proved impossible to changerepparttar 131698 location ofrepparttar 131699 site inrepparttar 131700 Dmoz directory to a travel listing rather than a boating listing.

If at all possible and to prevent users who are sick of being asked for their credit card information or being given 30 different porn sites upon entering Travel Tales ofrepparttar 131701 Sea into a search engine, it would be nice to see a shift in emphasis inrepparttar 131702 way thatrepparttar 131703 search engines operate their listings.

Certainlyrepparttar 131704 idea of switching on a computer and being faced with two choices, one for sites that are-for-profit and one that points towards not-for-profit sites would be a dream come true. To enter in a search request and to not find amazon.com or ebay.com inrepparttar 131705 first few results would put cheer to any searchers hopes of finding what he wants. And maybe in this way a true exchange of information may be facilitated andrepparttar 131706 mass exodus of searchers back torepparttar 131707 public library for information may be halted.

Ieuan Dolby is the Author and Webmaster of Seamania . As a Chief Engineer in the Merchant Navy he has sailed the world for fifteen years. Now living in Taiwan he writes about cultures across the globe and life as he sees it.


    <Back to Page 1
 
ImproveHomeLife.com © 2005
Terms of Use