.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

Not able to save checkbox values as TRUE on record creation

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :SharePoint
I have a form I created in InfoPath 2010 on a SharePoint 2010 list. As part of this list, there are 6 yes/no columns.  Each yes/no column I have bound to a different checkbox in the InfoPath form.  In SharePoint, when I view the list and click "add new item", the blank InfoPath form appears, I edit the form and submit it.  All works fine.... EXCEPT the checkboxes.  It seems that the checkboxes always save as FALSE the first time I save a new record. If I save the new record, and then choose to "edit the item", I can set any or all of the checkboxes to true, and it works fine.  But on the initial creation of the record (using InfoPath), the checkboxes always end up being persisted as FALSE. If I create a new record directly in the list (using the datasheet view), I am able to save the yes/no fields as YES, and they persist.  So the problem really does seem to point to the InfoPath form. Any thoughts on how I can persist a TRUE value for these checkboxes when saving for the first time?

View Complete Post

More Related Resource Links

How to save checkbox values into sql server 2005 via c#

Hi there

I want to know how I can save a checkbox value into sql server 2005?  The check box is in my windows forms application...


FormView KeepInEditMode=true isn't retaining values


I have an "Edit Page" in my application. It uses a FormView bound to an EntityDataSource.

I have a handler setup for the FormView OnItemUpdated event. If an exception occurs (such as foreign key constraints or non date vales entered in a date colum, etc.), then I set the "KeepInEditMode=true". This is SUPPOSED to retain the user entered values on all of the text boxes instead of rebinding the FormView to the data again and clearing those text boxes. (Right?)

Well, it isn't working...

I have stepped through the code via the debugger and the "KeepInEditMode" does get set to true, but as soon as the page reloads, the values revert back to the original database values (the data is being rebound).

I should also mention that I am setting "ExceptionHandled" to true. I am doing this because I am handling the Exception by displaying an error in a specific area of the page and if I dont mark it as handled, IE generates an Exception popup.

Any ideas?

Values in user control fields empty when AutoEventWireup=true ?

As a BizTalk developer I'm trying to build a ASP.NET website so some obvious things might be new to me (so please be gentle). I have a web form and I have a user control on it. This user control contains a panel with some user properties that are to be stored in a database. So far nothing fancy. The user control itself contains a panel and is working fine (all code to retrieve and store the values is working). I used the default settings of creating a user control and one of them was AutoEventWireup=true. This works fine because I also have some dropdown boxes (and other fields) that need to be filled with values from the database and that happens in the Page_load event. The panel specifies the 'DefaultButton' which calls a method when clicked to save the values after the user has changed them. On this click the code of the method is called, I confirmed that, but I found out that the values of my controls on the user control (for example the Textbox control) are empty. As a non-ASP.NET developer I couldn't figure out why. So I changed some settings like AutoEventWireup to false. Off course this resulted in my dropdown boxes no longer to be initially filled, but my surprise was big to find out my controls actually contained the values the user typed in. Logically I need both the values and th

Setting Managed MetaData default values on site creation

I am working on a project where the requirement is to have specific document content types.  I have therefore create a site columns feature which creates all my columns, I have a Site Contentypes feature which creates all my content type and I have list templates based on my content types.  I also have created a couple of Site definition features which create specific list instance based on my list template As part of my content types I have created a few Managed Metadata fields which I wanted to set defaults for on the creation of my sites.  I have therefore created a feature which is right at the end of the WebFeatures section in my ONET.xml.  This features enumerates through all lists, looking for specific column names(managed metadata columns) and looks to set these to specific values.  The code to set the default value on the field is: TaxonomyField documentCategoryField = (TaxonomyField)library.Fields["Document Category"]; if (documentCategoryTerm != null) { documentCategoryField.DefaultValue = documentLibraryDefault.ToString(); documentCategoryField.Update();                                                     }                         &n

How to Save a Record ?

I need to save a record of 10 columns. for this thing we created a Class file for 10 parameters.class.cs(declared 8 parameters(col1,col2,......col6 in class.cs file).i had created a stored procedure for insertion record.Now i am having a method and passing 2 in a method likeinsertrecord(class temp1, column9 col).How to Execute this 1? and 1 more thing column2 is related to another table.Col2 is having ID values only and those related values get from the Table2.How ???Urgent???Waiting for your replies

How to add a new button to the newform.aspx page which says "Save and add another record" ?

Team, I have a scenario where my client wants me to add a nother button to NewForm.aspx page in addition to Save and Cancel buttons. The job of that buttom should be to save the record and open that new form again. Is this possible.If yes can you guie me how to do it though designer? Thanks in advance. Deepti.  

Add checkbox values to profile

I am learning how to use profiles. My profile properties are defined in web.config and wish to add selected checkboxlist values to user profiles. TextBoxes and RadioButtonLists all seem to work fine, but not my CheckBoxList values. How do I go about making this work? Regards.

CheckBoxList - save values to SQL

Hi, I have a checkboxlist on a c# page where when a box is checked it saves its value in the following format to a textbox 1,2,3, etc...  String values = ""; for (int i=0; i< cbl.Items.Count; i++) { if(cbl.Items[i].Selected) { values += cbl.Items[i].Value + ","; } } values = values.TrimEnd(','); This works ok however the problem is i want to be able to audit the values i save in the DB. For example i may want to do a count how many times 1 appears or 2 etc.. What is the best way to do this? Thanks 

Save temporary values in gridview to database

Hi.I have a code here,where it will store temporary data in a gridview from textbox where when the data is stored temporarily in gridview.Alternately,it will be linked to search the word in google.Now i want to save the values in the gridview to database.I m new to asp.net,seeking ideas from all.Any ideas guys?Here is my .aspx code: <body> <div> <table > <tr> <td class="style1"> <asp:Label ID="Label1" runat="server" Text="Caller Info :"></asp:Label> </td> <td style="width: 100px"> <asp:TextBox ID="TxtName" runat="server" class="cls" onekeypress="" ToolTip="Press Enter key for new input"></asp:TextBox> </td> </tr> </table> <asp:Button ID="BtnAddToTable" runat="server" align="right" class="cls" Text="Add" OnClick="BtnAddToTable_Click" /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" > <Columns> <asp:TemplateField HeaderText="Caller Information"> <ItemTemplate> <a onclick='document.getElementById("<%=iframe1.ClientID%>").src = this.href; return false

validation alow to save record


Hi All.

Detail form has some validated fields but when I click SAVE button record are saving in database. How prevent to save record if field is validated?


How to read checkbox values from programmatically created checkboxes?


I have a form that does a loop to create checkboxes.  Here is the code in the loop:

cbxDrives.Top = TopPosition;
cbxDrives.Left = LeftPosition;
cbxDrives.Text = d.Name; 
CheckBox cbxDrives = new CheckBox();this.Controls.Add(cbxDrives);

This creates multiple check boxes on the form, and this works fine.

However, in the code behind for my button that the user clicks to execute the form, I cannot figure how how to read the values for the checkboxes.  I've tried:

foreach (CheckBox cbxDrive in cbxDrives)


Passing numeric checkbox values into a select statement


For efficiency's sake I've created a number of stored procedures to run against an SQL table.  Which procedure runs depends upon the checkboxlist choices a user makes before clicking a button.  The checkboxlist looks something like this:

      <asp:CheckBoxList AutoPostBack="True" runat="server">

         <asp:ListItem Enabled="True" Value="1">Item 1</asp:ListItem>

         <asp:ListItem Value="10"> Item 2</asp:ListItem>

         <asp:ListItem Value="100"> Item 3</asp:ListItem>

      </asp:CheckBoxList>As an example,


What I can't figure out is how to loop through the checkboxes in the Button1_Click event in the .cs code behind page to add up the values of the selected items. (The value of an unclicked box being 0.)  Converted to a string, the totaled value is then appended to a stored procedure name (MyPROC) for entry into the SQL statement.  In other words, if the user clicks just Item 1, then the Button1_Click event would produce a stored procedure name of MyPROC1, insert it into the statement, and fire off the query; if Ite

How to save a multiple user control to a few single record text?

I have a list with people pecker control that admits multiple users.
I like to have another list with one record for each user in the control that loaded before.
Is there any way in InfoPath or in a workflow to use something like FOR EACH to take one by one user in a control and write/update records after that?
Thank in advance

What is causing oracle datbase table failing to save inserted Record permenantly?


I have a table in orcale database where I am inserting records. I am able to insert a record in a table but it is not being saved permenantly.When inserting there is no error. what could be causing this?

Add a checkbox header in grid with autogeneratecolumns=true


HI! I try to add a header checkbox to selecte all in the column, I know that with templeate field you can but the problem is that i don't know the number of columns. How i add a checkbox to the header in every column?

Default Column Values in a Document Library (SP2010) do not show up in word 2010 until you save and


when you create a document in a SP 2010 document library (of a particular content type, by clicking new, letter (content type name) in sharepoint for example) which has default values set on in in the library (set by using library settings -> change default column values), the default values do not show up until you create the document , save it and reopen it again.  Is this a bug or by design.  If it is by design, it is horrible since if some of the column default values are mandatory in the content type then you actually have to type them in before you could possibly save the file which defeats the whole point of having default column values.  Also it is tremendously clunky for a user to have to create file, save it , close it, and reopen it just to view the default metadata in the document information panel that is supposed to be there.

Anyone have any thoughts/solutions to this problem?


Save button on custom EditForm.aspx locks record



I am having an issue with my EditForm.aspx on a list. My problem is that when I make a change to a record and click save (and it brings me back to the page), the first set of changes are saved fine but if I then enter more content and click save without refreshing the page I get the error:

 Save Conflict.

Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.


This is the code that I am using for my save button:

<input type="button" value="Save Changes" name="btnFormAction" onclick="javascript: {ddwrt:GenFireServerEvent('__commit')}" style="padding: 5px; border-style: none; background-color: #21374c; color: #FFF; font-weight: bold; font-size: 14px;" />

 Is there something I need to add to my code that unlocks the record once it has been saved?

Thanks in advance for the help :)


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