Note that there are some explanatory texts on larger screens.

plurals
  1. PONested repeater with Checkbox list using asp.net
    primarykey
    data
    text
    <p>I am trying to do a nested repeater control with check box inside. Basically, what i want is categorize the checkboxes like,</p> <pre><code>Group 1 Item 1 Item 2 Group 2 Item 3 Item 4 Group 3 Item 5 Item 6 </code></pre> <p>The problem I am facing is, I getting the error : </p> <p>Error 1 : 'DataRowView' is not declared. It may be inaccessible due to its protection level.<br> Error 2 : Name 'DataRowView' is not declared. </p> <p>ASPX : </p> <pre><code> &lt;asp:Repeater ID="rp_Groups" runat="server" OnItemDataBound="rp_Groups_ItemDataBound" &gt; &lt;ItemTemplate&gt; &lt;ul&gt; &lt;asp:CheckBox runat="server" ID="chk_Group" Text='&lt;%# Eval("category_type") %&gt;' Value='&lt;%# Eval("service_type_category_id") %&gt;' onclick="OnGroupClick" /&gt; &lt;p class="nested"&gt; &lt;asp:CheckBoxList runat="server" ID="chk_Items" DataValueField="ServiceTypeID" DataTextField="Name" DataSource='&lt;%# ((DataRowView)Container.DataItem).CreateChildView("FK_esnServiceType_Service_Type_Categorization") %&gt;' &gt;&lt;/asp:CheckBoxList&gt; &lt;/p&gt; &lt;/ul&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>Codebehind:</p> <pre><code>Public Sub Fill() Dim dtServiceCategory As DataTable = ServiceTypeModel.GetService_Categories() Dim dtServiceType As DataTable = ServiceTypeModel.Search("", True) rp_Groups.DataSource = dtServiceCategory rp_Groups.DataBind() Dim ds As New DataSet() ds.Tables.Add(dtServiceCategory) ds.Tables.Add(dtServiceType) Dim relation As New DataRelation("FK_esnServiceType_Service_Type_Categorization", ds.Tables("dtServiceCategory").Columns("service_type_category_id"), ds.Tables("dtServiceType").Columns("CategorizationID"), False) ds.Relations.Add(relation) relation.Nested = True End Sub Protected Sub rp_Groups_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rp_Groups.ItemDataBound Dim chklist As CheckBoxList = DirectCast(e.Item.FindControl("chk_Items"), CheckBoxList) If chklist IsNot Nothing Then chklist.DataSource = DirectCast(e.Item.DataItem, DataRowView).CreateChildView("FK_esnServiceType_Service_Type_Categorization") chklist.DataBind() End If End Sub </code></pre> <p>What am i missing ? </p>
    singulars
    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