Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET checkbox VB.NET , +
hope u r doing well.
 
I have a listview with two sqldatasource outside. Inside the listview there is a label and a checkboxlist. The label is to display the category titles. I wanna databind the each checkboxlist to its coressponding data. I don't know how to do. Please explain me with abit of code as i am a beginner developer. Thanks so much for your help. I googled alot and found people with same problems and others solutions to their problems. But i don't know how to re-use those solution in my program. Frown | :(
 
That's the code i have. I don't have anything in codebehind. With this code, it shows the data with different categories but all the checkboxlists show same thing, which is right for the first checkboxlist. Thanks so much again.
 
 <asp:ListView ID="ListView1" runat="server" DataSourceID="ListViewSqlDataSource" >
        <ItemTemplate>
            <asp:Label ID="CategoryNameLabel" runat="server"><%# Eval("CategoryName") %></asp:Label>
            <asp:CheckBoxList ID="CheckBoxList1" runat="server" DataSourceID="SqlDataSource1" DataValueField="SortOrder" DataTextField="DocumentName">
            </asp:CheckBoxList>                            
        </ItemTemplate>
    </asp:ListView>
 
    <asp:SqlDataSource ID="ListViewSqlDataSource" runat="server" ConnectionString="<%$ xxx:xxx %>" 
        SelectCommand="EXEC [Docs].[CategoryList] @UserName = 8882074, @Service = 9">
        <SelectParameters>
            <asp:Parameter DefaultValue="8882074" Name="UserName" />
            <asp:Parameter DefaultValue="9" Name="Service" />
        </SelectParameters>
    </asp:SqlDataSource>
 
      <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ xxx:xxx;" 
 
        SelectCommand="EXEC Docs.[DocumentList] @UserName = 8882074, @Service = 9,  @YearGroup = NULL, @Category = 1">
        <SelectParameters>
            <asp:Parameter DefaultValue="8882074" Name="UserName" />
            <asp:Parameter DefaultValue="9" Name="Service" />
            <asp:Parameter DefaultValue="1" Name="YearGroup" />
            <asp:Parameter DefaultValue="1" Name="Category" />
        </SelectParameters>
 
    </asp:SqlDataSource>
Posted 18-Jan-12 2:20am
Edited 18-Jan-12 2:21am
v2
Comments
Jephunneh Malazarte at 19-Jan-12 1:39am
   
see answer to your post in asp.net forum.
 
http://forums.asp.net/t/1760253.aspx/1?How+to+databind+checkboxlist+inside+ListView+with+SqlDataSource+vb+net+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 BillWoodruff 360
1 Mathew Soji 309
2 Maciej Los 270
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 202
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web02 | 2.8.1411019.1 | Last Updated 18 Jan 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100