Take for example some kind of menu structure. You want to display a category, but every category can have 0 or more subcategories. With 1 repeater, this cannot be done in a simple way. In .NET, you can use nested repeaters for this. Take code below in .aspx file: ... other HTML code ... <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> </ItemTemplate> </asp:Repeater> ... other HTML code ... Here you will get a list of categories. If you want to add subcategories, one could try to make code below work.
... other HTML code ... <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"> <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 ... To make things work, you have to change several things though. In your .aspx.cs file (or in script area if you are not using codebehind files) you will have following code:
... other c# code ... DataSet sqlDS = new DataSet();
/* Get categories */ string Query = "select CategoryId, Category from Categories order by Category";
SqlCommand sqlC = new SqlCommand(Query, objConn); SqlDataAdapter sqlDA = new SqlDataAdapter(); sqlDA.SelectCommand = sqlC; sqlDA.Fill(sqlDS, "Category"); /// Our dataset contains categories /* Get subcategories */ string Query = "select SubCategoryId, CategoryId, SubCategory from SubCategories order by SubCategory"; sqlC = new SqlCommand(Query, objConn); sqlDA.SelectCommand = sqlC; sqlDA.Fill(sqlDS, "SubCategory"); /// Our dataset contains categories /* Add a relationship between 2 tables In our case, every SubCategory has a CategoryId to pojnt out there parent */ ds.Relations.Add("CategoryRelation", ds.Tables["Category"].Columns["CategoryId"], ds.Tables["SubCategory"].Columns["CategoryId"]);
| | How to get noticed on the InternetWritten by Ieuan Dolby
The World Wide Web was an enormous step for mankind, a step not seen since Neil Armstrong sullied surface of moon. The idea behind WWW came across as a veritable information highway where documents, data and info could be rapidly sent and accessed by millions world over. The potential behind web is enormous and even now scope is not fully utilized. The possibilities for growth, for extended usage, are available and enormous yet system is stagnating and it is very possible that people will soon turn away. The average person seeking information may well return to old-fashioned libraries and good old book to find information that they require if face and image of WWW is not altered very soon and in-line with customer demand.The ability of any user to gain information from Internet is enormous, simple and with positive results. But information received is increasingly becoming that which a paying body prescribes and thus is advertisement biased or pointed towards end purchase of a product. Hotels advertise a city or holiday resort with point of view of potential tourists coming to stay. A detailed description of moon cakes in Taiwan although complete and detailed would certainly be with aim to make people buy some from store hosting website involved. Initially Internet was heralded as a one-stop point for gaining any type or form of information with click of mouse. This is certainly true except with regard to loose information that has no affiliation towards an end purchase or a users change of heart. Certainly this type of information is available and millions of websites exist but unless a user has prior information on how to access this site then chance of it being found amongst masses is minimal. Most web users find or locate information by using a search engine. Most web users input their request and wait for results to come up as prescribed and ordered by search engine system. If for example a request was entered for “travel tales on sea” many, possibly thousands of choices will appear in return. Number one in pole position will probably be Amazon.com who feels certain that anybody looking for a story would probably find it amongst their collection – naturally obtainable at a price. The next on list might be Ebay who feel that certain travel products might appease searcher or it might be goarticles.com an articles selling service who would assume that travel tales of sea would be somebody looking to buy such from them and for their own use. Certainly each and every result that is produced on first page would point user towards large companies who are selling an item of one sort or another. The user though may in fact just want to read some Travel Tales of Sea without having to fork out cash or to issue his/her credit card information over Internet. In bowels of search results in pages that are covered in dust will reside some very comprehensive and useful websites, eg: http://www.seadolby.com a website that is filled with free and in-depth Travel Tales of Sea. The possibility of any user keeping interest long enough to get to this web site listing is minimal and long before it is reached user has either fallen asleep or entered another search on a different note. In short average user does not get past first page of a search engines results and probably not past first three that come up: e.g. amazon.com, ebay.com and goarticles.com Although not-for-profit informational web sites are many and filled with amazing and detailed info these sites ability to gain attention on world stage is difficult unless money is poured in to boost their ratings and rank positions on search engine results. Nowadays many search engines have entered pay-per-click arena with companies putting forward money to buy keywords that will most likely be used to boost their website. Some company buys word “Travel” and this word is then basically lost forever to lone free-for-all info site who cannot afford to pay money to boost their popularity. The art of advertising and paying for positions on search engines is only available to sites that can afford exorbitant fees. Should a lone site owner who has built his site-up decide to fork out of his own pocket money to boost his ratings this will only be achieved on one or two search engines or directories and amount required to compete with mega-sites is far beyond any hobbyist can afford. Naturally ability to submit ones site on free inclusion pages and directories is available but as webmaster and author behind Seamania found out, so much energy and time is spent on advancing ratings of his site that not enough time is given to writing of travel tales of sea, which of course is basis and sole point behind website in first place.
|