.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How do I store a list of checkbox choices in the DB most efficiently?

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :ASP.Net

I'm not expecting a full solution here (unless you really want to), just some tips and pointers.

I have a User table and an Area table. The User table has userID, userName etc., and the Area table has areaID, areaName etc.
I'm binding the list of Areas to a checkboxlist where the user MUST choose between 1-3 options. I'm using a stored procedure to update the DB.

Is there a common solution to this problem that I haven't found?

I have thought about saving it as a comma separated string in a field in the user table. This looks like a temporary and ugly solution though, do you think?

A nicer solution would be to create a UserArea table where I save the ID's as foreign keys from areaID and userID. But I don't know how to write this stored procedure where I update and insert the choices made.
This way would also help me when I need to get statistics, plus it's moer scalable, I think.

Any help is greatly appreciated!


View Complete Post

More Related Resource Links

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Custom List Row association to multiple documents - Design choices?

I want to associate custom list entries to muliple documents. Thinking about options.   1 row will have many docs, but one doc will only have one row. Possible? Trying to keep it simple with minimal development. I was thinking I could have a unique column or the id column in the list act like a key (somehow).. and  add a required column to the document list requiring it to tie back to the list entry.  Then a view could drive listing all the docs for a particular row from a link in the list built in a custom dataview. All the docs could be in the same library. Is the the best approach? Ideas/suggestions? Thanks.

How to Add A Scroll bar to ChecKbox List

Can any1 guide me to add scrollbar to checkboxlist Regards Chandrakant 

Is there a way to parse information in a word document and store them on a list (MOSS2007)? (Without

My current project requires me to parse through a Word document with tables that simulate a form. However Infopath isn't an available rescource for me. For example I'm to bring all information in the notes cell onto a list in sharepoint. Ultimately i'll be using a view to display that list through a webpart on a dashboard like interface on a sharepoint page. Is this possible? or is Info Path really the only way to go about this?

get sharepoint list item column choices using caml

basicallly the title says it all, is there a way to get a sharepoint list's column's choices using CAML query? i'm trying to get the choices using the sharepoint web service

checkbox list help!!!

How can   I make the following code shorter and more efficient.  Goal:  I want to loop through the check box list for all true values.   I want to get the check list item and complare with database value then check the box.                For Each xList As ListItem In cblGroupDiningOptions.Items                        If xList.Text = "Meals_List" Then                            If eContentItems.Meals_List = True Then                                xList.Selected = True                           End If                        End If                 &n

Object reference not set to an instance of an object in Nested Repeater Control of CheckBox List con

 if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
                Repeater rptsub = (Repeater)item.FindControl("rptsub");
                CheckBoxList Chksub = (CheckBoxList)rptsub.FindControl("Chksub");
                Label lblsubroot = (Label)rptsub.FindControl("lblsubroot");
                DataRowView row = (DataRowView)e.Item.DataItem;
                RootId = Convert.ToInt32(row["IdApplication"].ToString());
                MetadataPermissions metadataPermissions = new MetadataPermissions(); ;
                DataSet rptRootValues = new DataSet();
                rptRootValues = metadataPermissions.GetrptSubMenus(RootId);
                DataRow[] drows = rptRootValues.Tables[0].Select("IdApplicationroot = " + row["IdApplication"].ToString());
                foreach (DataRow chkpermsns in drows)
                   ListItem li = new ListItem(chkpermsns["PermissionName"].ToString());


<asp:Repeater ID="rptroot" runat="server" OnItemDataBound="rptroot_ItemDataBound">

Filtering with Multiple selections (Checkbox list control)

I have a scenario where there is a large list of 2000+ items, these items each have a name associated to it.

I now need to be able to filter this list by selecting the names from a Checkbox list, the problem is I cannot figure out how to get it to work when multiple values are selected.

The current setup is Using a DVWP to display the items a Datasource control of all the names and then the ASP.NET Checkbox list control to act as a filter

Can anyone help?

using a checkbox list and Table Valued Parameters


I have a checkboxlist that gets all all the items from a look up table. The user is going to go to the list, check certail items and insert the checkboxid, the value (0 or 1),  and the userid  into a table valued paramater using a stored procedure. I have the user defined table type created but thats about it. Any body out there have any hints.

update dynamic checkbox list


Hi there .. on page load I fill a repeater with checkboxes. I use a separate tablelist (subcatID & userID) to check if chkbox is checked or not.

On pageload and works fine (according boxes are checked):

For i = 0 To rptFavorites.Items.Count - 1
                Dim subcatID As Label = DirectCast(rptFavorites.Items(i).FindControl("lblSubcatID"), Label)
                Dim available As Label = DirectCast(rptFavorites.Items(i).FindControl("lblAvailable"), Label)
                Dim chksubcat As CheckBox = DirectCast(rptFavorites.Items(i).FindControl("chkSubcat"), CheckBox)

                Dim conn3 As New SqlConnection(ConfigurationManager.ConnectionStrings("VCConnString").ConnectionString)
                Dim cmd3 As New Data.SqlClient.SqlCommand("Select * From tbl_interest where userID=@userID and subcategory=@subcategory", conn3)
                cmd3.Parameters.AddWithValue("@userID", "28")
                cmd3.Parameters.AddWithValue("@subcategory", subcatID.Text)
                Dim myReader3 As Data.SqlClient.SqlDataReader
                myReader3 = cmd3.ExecuteReader()
                If myReader3.Read() Then
                    chksubcat.Checked = True
                    available.Text = "Y"

MVC2 Convention for Many-to-Many Relationship and Checkbox List?


I have a many-to-many relationship in my database (and Entity Framework Model) as follows:


Can anyone tell me the convention for creating a list of checkboxes for Data Admin that my users can select to fill the USER_DATA_ADMIN table?

(kind of new to MVC2)


SharePoint Custom List Attachment to Store URL and Not a File


I need to ust the attachment column for a list, but I want to store the URL NOT the attached file.  I could use a Link Column type, but doesn't have the browse utility that the attachement column has. 

Any ideas?  I would like to store the URL and not the FILE with the browse utility

Client-side checkbox list validator?


I've looked at these:



but these both work server-side (unless I'm missing something). I had hopes for the second one because it embeds javascript.

I have other validators on the page, and I want to show everything at once.  But the other ones are client-side, while the two I tried don't show the error message until the page posts back.

accessing checkbox list from with in edit item template.


Protected Sub dsEmployeesByDepartments_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting
        'Determine which checkboxes have been checked
        Dim selectedDepartmentIDs As New List(Of String)
        For Each li As ListItem In CategoryList.Items
            If li.Selected Then

Auto-Update Managed Metadata Term Store from External DB or List

Hi all,

I have been able to import terms using the .CSV file within the MMSA Term Store, but is there a way to auto-update the terms from an external list. Example: An external database already has terms and adds terms on a regular basis. Is there a method for updating the Term Store automatically when terms are added in the external source. Perhaps creating a SharePoint List populated with external data and somehow linking this up to the Managed Metadata terms? I know that System keywords are added to the term store when a user tags an item, but is there a way to tie into this functionality for managed metadata?

Unable to store value back to list from NewForm.aspx

   In the List when we click "New" menu it will redirect to "NewForm.aspx" to get the value from the user. It have default webpart, as per our column. Now i unghost the webpart using designer and to make some UI change, but now am unable to store the value back to the list. The "Newform.aspx" page got reload. why it happen?, what  i have to do?

How to create a dynamic list of checkbox controls in Infopath


I am relatively new to sharepoint, and since I do not yet have a proper development environment in my current contract, I have had to attempt to produce solutions to various line of business problems using Nintex and Infopath alone.  They are working on getting one created for me but i still can't believe microsoft make you purchase a whole other sharepoint server licence unless you think developing directly on the live server is a good idea, but I digress, thats not the issue I need assistance with.

The current issue I am trying to find a solution for, or atleast the right way to approach, is the creation of a simple form where the user can check off a register of daily tasks completed and submit the form back to sharepoint from a tablet PC.  Each submission is to create a new entry in the DailyRegister list with a handful of other fields like who, where, when, etc.

That is the easy part that I was able to produce with relative ease, but where it gets tricky is they want the list of tasks to be dynamic. 

i.e. A separate sharepoint list that will just hold the list of currently relevant tasks to be included in the form for that day.  Effectively using a 3rd list as the relational reference table between the DailyRegister list and the AvailableTasks list.

I am planning to create the AvailableTasks list to look something like:

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend