Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabinding each checkboxlist in Repeater control (asp.net 4)
    text
    copied!<p>Having asked my last question here _ <a href="https://stackoverflow.com/questions/8715328/creating-dynamic-boxes-divs-with-different-titles-returned-by-sp">Creating dynamic boxes (divs) with different titles returned by SP</a></p> <p>I created a repeater control and create few boxes (divs). I could successfully create Titles for each boxes. My next big step is to have Checkboxlists in the repeater control. Those checkboxlists are populated by data returned by a stored procedure. I have about 8 boxes but this number vary depend on the data returned by the Stored Procedure. With the code i have now, all the checkboxlist will display the same data. I need to have different checkboxlist for each category. My next step will be to create SelectedIndexChanged Events and refilter all those checkboxlist. The overall design and idea is sort of like Search Filter that we find on shopping carts. I found some say Repeater are just good to display data so may be i have to use something else. I can't brainstorm how this can be achievable. I have to use VB.net. The database is SQL server 2008. Using Linq for datasource is alright. Please give me suggestion how this can be achieveable. Please also suggest best control to achieve this. I don't need to stick to repeater control.</p> <pre><code> &lt;asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_OnItemDataBound" &gt; &lt;ItemTemplate&gt; &lt;div class="portlet"&gt; &lt;div class="portlet-header"&gt; &lt;%# Eval("categoryLabel") %&gt;&lt;/div&gt; &lt;div class="portlet-content"&gt; &lt;asp:CheckBoxList ID="CheckBoxList1" runat="server"&gt; &lt;/asp:CheckBoxList&gt; &lt;/div&gt;&lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <hr> <pre><code> Protected Sub Repeater1_OnItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) Dim x As New SIDLinqDataContext Dim item As RepeaterItem = e.Item Dim query = x.GetSelectedValue(xxxx, xxxx) Dim cbl1 As CheckBoxList = DirectCast(item.FindControl("checkboxlist1"), CheckBoxList) For Each aa In query cbl1.items.add(New ListItem(xxxx, xxxx)) Next End Sub </code></pre> <hr> <pre><code> OnLoad page event Dim dc As New SIDLinqDataContext Dim query = dc.GetCategories(1710307, 9) Repeater1.DataSource = query Repeater1.DataBind() </code></pre>
 

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