tags:

views:

50

answers:

1

Hi All,

i my website i am using Repeater control which further contain checkboxlist control.

Now my problem is that i have successfully bind "Parameter Type" in repeater control but when i am binding checkbox values, it does't appears in display

<asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <h4>
                    <%#Container.DataItem%></h4>
                <asp:CheckBoxList ID="chkParList" runat="server" RepeatDirection="Horizontal" 
                DataTextField = >
                </asp:CheckBoxList>
                <br /><br />
            </ItemTemplate>
            <SeparatorTemplate>
                <hr />
            </SeparatorTemplate>
        </asp:Repeater>

In *.cs file following are my code

IMonitoringDataInfo objMonitoringDataInfo = new ChannelFactory<IMonitoringDataInfo>("MonitoringDataInfo").CreateChannel();
                Collection<ParameterDetailDTO> clParameterDetailDTO = objMonitoringDataInfo.GetAllParameters(idList, out errorCode);

                var parameters = (from resx in clParameterDetailDTO
                                  select resx.ParameterType).Distinct();

                Repeater1.DataSource = parameters.ToList();
                Repeater1.DataBind();
                counter = Repeater1.Items.Count;
                while (i < counter - 1)
                {
                    foreach (var parType in parameters)
                    {

                    var items = from resx in clParameterDetailDTO
                                where resx.ParameterType.ToLower().Contains(parType.ToLower())
                                select new { resx.ParameterName, resx.ParameterID };  

                        ((CheckBoxList)(Repeater1.Items[i].FindControl("chkParList"))).DataSource = items;
                        ((CheckBoxList)(Repeater1.Items[i].FindControl("chkParList"))).DataTextField = "ParameterName";
                        ((CheckBoxList)(Repeater1.Items[i].FindControl("chkParList"))).DataValueField = "ParameterID";
                        ((CheckBoxList)(Repeater1.Items[i].FindControl("chkParList"))).DataBind();


                    }
                    i++;
                }

I am using LINQ as datasource

Please help?

A: 

Try putting your CheckBoxList binding inside the ItemDataBound event of the repeater.

See:

Repeater.ItemDataBound Event

Using OnItemDataBound with Repeater in ASP.NET and C#

DaveB