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

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

loop list to find checked checkboxes

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :C#
I have a web part that shows a document library.  There is a column with a checkbox.  If the checkbox is 

checked and submit button is clicked, the selected item should then be copied to another list.  My 

code below copies all items, even the ones that are not checked.

Please help!



(SPListItem item in sourceList.Items)



foreach (GridViewRow row

View Complete Post

More Related Resource Links

Disregarding updates on non-checked-in entries in a sharepoint list (SPAudit)


Hey guys.

Okay, this is a little hard to explain, as the title might suggest.

I have an event receiver on ItemUpdated and ItemCheckedIn, which both writes custom SPAuditEntries. When CheckedIn occurs though - it comes with two update entries as well (one for added file, and one for a simple update to the list item I suspect).

I'd love to get rid of these entries. At first I thought it would be really simple, just put an if in the itemUpdated event receiver, and stop everything

if(SPListItem.CheckedOut = false) { //... do nothing }

However I couldn't find any way to ascertain the checkout-status of the listitem. My next thinking was, they hit almost at exactly the same time, so I could just crawl into the auditCollection, filter down to the specific listitem, user, and time (minus a second) and delete the two entries. But, sadly I found out I couldn't delete auditentries.

Anyone got any ideas?

Where to find the latest list of critical SQL Server fixes?

Hi, Where can I find the latest list of critical SQL Server fixes?

For loop to find sum and average

I am trying to write a program that will use the for loop to find the sum, and average of 10 numbers a user enters. I was able to do something like this with out a for loop but I want something a bit more efficient . double num1; double num2; double num3; double num4; double num5; double num6; double num7; double num8; double num9; double num10; Console.Write("Please enter a number: "); num1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num2 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num3 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num4 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num5 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num6 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num7 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num8 = Convert.ToDouble(Console.ReadLine()); Console.Write("Please enter a number: "); num9 = Convert.ToDouble(Console.ReadLine()); Conso

Find Announcement List Template

Hi, I created a list template based off the announcement list. I added some columns to it and saved it as a template. Is there a way (programmatically) to check to see if a list was based on my specific template? I see my list still uses the announcement featureID and ID but I only want to find lists created with my specific template. Thanks for any help.

How to order checked checkboxes

hi everyone i have an infopath 2007 form and i have couple checkboxes in a mutiple selection list box. I wanna know is there a way while I'm saving the form it just keeps the selected checkboxes or otherwise if it's too complicate is it a way to order them and have the checked on the top to retrieve them faster

List and adding checkboxes

Hello, I am using a TabControl on my Windows Form with several tabs. I have got checkboxes on each tab. When a user clicks on the button I will add selected checkboxes into a list control (List<CheckBoxes>). The problem is that the checkboxes are added into the list in very unusable order (e.g. the last (the lowest) checkbox on the tab is added before the first checkbox on the tab. How can I control the order the checkboxes are added into the list? Sorry for my English. Thanks.  

Cancel multiple WFs at once & global list find & replace

We have a number of products in our company, and a need for an email alert for various reasons for each product. Thus, I have a SP list where each list item has a drop-dead date, plus the manager's name and manager's email address as well as a note as to what needs to be done. When a new item is created, or a list item is changed, a workflow is initiated. Remember, each single product associated with a manager can have dozens of these email alert list items with differing drop-dead dates. The workflow is designed to send alerts out at stated intervals before the drop-dead date. The problem is that the manager in charge of a given product can and does change. What I have to do now is to open each of the items that pertain to that manager, stop the existing workflow, change the manager's name and email address in the item, then save it (thus starting a new workflow). This can get tedious when a single product can have several dozen list items corresponding to several dozen drop-dead dates. I would like to be able to filter the list, kill all the workflows that are connected to each item in the filtered list, change the manager name and email using the Datasheet facility, then save. At that point, X new workflows would start where X is the number of list items in the filtered list. 1. Is that possible (I doubt it) in our native SP 2007? 2. Does anyone

Unable to find Control in List



I'm trying to define the parameters of my data source using a stored procedure. My Stored Procedure Syntax is perfect and i'm happy with that, i've just got trouble with connecting my parameters to my controls. I have 19 Parameters, of which i've managed to connect 17 to controls within my ASP.Net form (some to text boxes, some to ddls etc...)

However, i'm trying to connect a particular parameter to a control, but when i drop down my list of controls it's not visible? The control is within a hidden panel so i've un-hidden it and it's still not there. I've even commented out the panel and tried that but i can't find this control! I just cant seem to get this control to appear in the list.

Has any one seen anything like this before at all?

If you need any more information please let me know. (for clarirty i've attached screen grab)

Control Not in list


External Content Type - Read List Operation - "Cannot find a collection element of a supported type.


I'm trying to define External Content Type Operations for an External Content Type. I can add a Connection, Type "WCF Service" no problem. And I can define a "New Read Item Operation" using that connection.

But I can't define a "Read List Operation". I get the following error message, in the Return Parameter Configuration: "Cannot find a collection element of a supported type..." it goes on to say - see the help documentation for supported types. I can't find any help documentation on this.

I've tried returning different types in the provider web service but keep getting the same error. What are the supported types the web service can return?

The reading I've done suggests that you can connect to a non-MS web service using a connection type of "WCF Service". Is this correct? If it is what's the best soap format the web service provider should use - Doc/Literal?



Regex to find nested list items

Hi everyone,

I am trying to write a regex parser that will extract links from some html that is generated within our services. Now, extracting items in html I am able to do, but I have n idea how to parse the links from the following, and keep the structure, e.g with the following menu

<ul id="menu">

What I have tried is

<ul id=\"menu\"[^>]*>(.*)</ul>

Now, this does get me the whole menu, but then If I do:


I can get the menu items, BUT, I lose the structure.

So I thought I would be able to extract the LI that contain the UL inside it, but the problem is that using the regex above to extract that LI, I retrieve the following:


Can anyone suggest a way that I can use regex to retrieve this keeping the same structure? or another way of processing these menus and being able to record the structure?



Error creating edit form for external list - Failed to find the default form for PAGETYPE PAGE_NEWFO


For the last few days we have been unable to create custom new/edit forms for External Lists in Sharepoint Designer.  When i try to create a form Sharepoint Designer show the message 'Could not save the list changes to the server'.  The corresponding message in the ULS log file is 'Failed to find the default form for PAGETYPE PAGE_NEWFORM'.  Does this mean i have somehow managed to break the form templates for External Lists?

I saw some other posts about the 'Could not save the list changes to the server' error and followed the suggested steps including removing all versions of the list and related content type, and recreatign htem but this didn't work.

Binding Text contains "comma separated items" to a checked list box


Stundent record contains a text field, this field contains a comma separated courses that the student have.
I designed a WPF form showing that field and alos a cheched list box showing all available with some items checked according to that text field. here is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MicrosoftCourses
  /// <summary>
  /// Interaction logic for MainWindow.xaml

Help: How to create a list(Ienumerable) using loop



I needed to modify the code(The test method part especially) present in the link ( http://blogs.msdn.com/b/lucabol/archive/2007/12/17/bisection-based-xirr-implementation-in-c.aspx)

Instead of Hard Coding the values for cash and date(under Test methods, for object such as cfs), I want to use a loop, which depending on the two arrays of cashflows and dates, that I am receiving, creates the object (cfs) insteasd.

So, right now the cfs is hardcoded something like( as can be seen in the link)

  IEnumerable<CashFlow> cfs = new CashFlow[] {
                new CashFlow(-10000, new DateTime(2008,1,1)),
                new CashFlow(2750, new DateTime(2008,3,1)),
                new CashFlow(4250, new DateTime(2008,10,30)),
                new CashFlow(3250, new DateTime(2009,2,15)),
                new CashFlow(2750, new DateTime(2009,4,1))

I want to do something like

IEnumerable<Cashflow> cfs = new Cashflow[5];

for (int j = 0; j < 5; j++)

Loop through SharePoint list and copy values into InfoPath Main Data



i have the following problem, i designed an Infopath form which should display the data (in a repeating table) from a SharePoint list, which is connected to the form.

 I found the following code in the internet to copy rows from a sharepoint list to a repeating node in the Main data source and followed the tutorial.

Public Sub CTRL48_6_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)

      Dim secDSNav As XPathNavigator = DataSources("Projektsummary").CreateNavigator()

      ' Zeilen aus der Projektsummaryliste auslesen
      Dim rows As XPathNodeIterator = secDSNav.Select( _
      "/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW", _

      'Dim Current As XPathNavigator
      'Loop durch die einzelnen Zeilen der Liste

      While rows.MoveNext()

        Dim name As String = rows.Current.SelectSingleNode( _
        "/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title", NamespaceManager).Value
        Dim nummer As Object = rows.Current.SelectSingleNode( _
        "/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Projektnummer", NamespaceManager).Value

        ' Werte der wiederholten Tabelle (main data source) übergeben 
        AddItem(name, nummer)

      End W

Gridview Loop through find total of labels with same value


Hey :)

I would like to know if someone can please help me

How can I loop through and find the TOTALS of all labels with the same values


For Each gvrow As GridViewRow In InsertedCompanies.Rows

Dim lblRegistrationComplete As Label = DirectCast(gvrow.FindControl("lblRegistrationComplete"), Label)

Dim lblIsJobPayedFor As Label = DirectCast(gvrow.FindControl("lblIsJobPayedFor"), Label)

Dim lblOutstanding As Label = DirectCast(gvrow.FindControl("lblOutstanding"), Label)

Dim lblJobPayedPrice As Label = DirectCast(gvrow.FindControl("lblJobPayedPrice"), Label)


If lblRegistrationComplete.Text = "True" And lblIsJobPayedFor.Text = "False"  Then

                lblOutstanding.Text = "Outstanding"
                lblOutstanding.Text = "Not Outstanding"


How do find out the column names of a particular list in content database?

I want to generate a report by getting data from various lists.I am using SQL server to query the content database.The problem is ,the column names are not displayed.It is as 'nVarchar1',nVarchar2',DateTime1','ntext1'.Is there any way to find out the column name?
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