Note that there are some explanatory texts on larger screens.

plurals
  1. POAssign separate link to each repeater item in ASP .net
    primarykey
    data
    text
    <p>I was trying to develop a forum website (trying to mimic some of its features) and I am using Entity framework to get my data. I have to use repeater as my instructor asked me to do so.</p> <p>I would be having something like this using repeater that gets data for "Forum Category" and "Sub-category" from 2 separate database tables:</p> <ul> <li><p>Forum Category 1</p> <ul> <li><p>Sub-Category 1</p></li> <li><p>Sub-Category 2</p></li> </ul></li> <li><p>Forum Category 2</p> <ul> <li><p>Sub-Category 1</p></li> <li><p>Sub-Category 2</p></li> </ul></li> </ul> <p>Now, I would like, when clicked on those sub-category list to be directed to the page of their own using query string and that is what I am not being able to figure out at this time. When I assign a link to those sub-lists, since they are automatically generated all of them point to the page that I initially assign. I was wondering if there was someway to dynamically assign links for this scenario. I was thinking of using ENUM, but again how do I run a for loop there. </p> <p>The code I have for the repeater is below:</p> <pre><code>&lt;asp:Repeater ID="categoryRepeater" runat="server" OnItemDataBound="RepeaterDataBinding"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="categoryLabel" Text='&lt;%#Eval("CatName") %&gt;' runat ="server" style="font-weight:bold;font-size:large" /&gt; &lt;br /&gt; &lt;asp:Repeater ID="forumRepeater" runat="server"&gt; &lt;ItemTemplate&gt; &lt;a href="DesktopForum1.aspx?ForumID=&lt;%#Eval("ForumID") %&gt;"&gt;&lt;%#Eval("ForumName")%&gt;&lt;/a&gt;&lt;br/&gt; &lt;%-- right up there. Instead of hardcoding "DesktopForum1.aspx?ForumID=" which makes all the links to point to that page, I am trying to achieve a way to assign links to specific pages for each sub-list... --%&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>I did try searching the forum, but could not come across with a problem that resembled my situation.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload