.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

Binding an event handler to a list

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :SharePoint


I am trying to bind an event handler to a list using the following code. I have the same code before with success, but I am not sure why it is not binding it anymore. Also I am getting no error, but the event is not firing when I bind the event handler using the following code:


static void Main(string[] args)
      int check = 1;
        SPSite collection = new SPSite("https://fullsitepathhere");
        Console.WriteLine("Working - 1");
        check = 3;
        SPWeb site = collection.OpenWeb();
        Console.WriteLine("Working - 2");
        check = 4;
        SPList temp = site.Lists["Data Storage"];
        Console.WriteLine("Working - 3");
        check = 2;

        string assname = "NewSaas, Version=, Culture=neutr

View Complete Post

More Related Resource Links

how to get values of list item being entered in ItemAdding event handler?

Hi,          i am trying to get the values being entered in a listitem in the ItemAdding eventhandler as follows, but it doesnt work. public override void ItemAdding(SPItemEventProperties properties)         {             base.ItemAdding(properties);             SPSite CurrentSite = new SPSite("http://mm-moss/np/");             SPWeb CurrentWeb = properties.OpenWeb();             SPList CurrentList = CurrentWeb.Lists[properties.ListId];             string vehicleNo = CurrentList.Items[CurrentList.Items.Count - 1]["Vehicle No"].ToString();             string  name=CurrentList.Items[CurrentList.Items.Count-1]["Name"].ToString(); } when i debug i cant get hold of the VehicleNo value. canyone help me in getting the values of the list item being entered? Thank you all.

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

Creating Event Handler in Code behind


Hi, so I have a control that is created in the code behind and generates fine but I can't figure out how to create an event handler for it.  I've found plenty of examples for it in C sharp, but none of them seem to apply to VB.  What I want to do is essentially this:

myDropDownList.SelectedIndexChanged = "Event to do here"

but it doesn't seem to work for me.

Any suggestions are appreciated.

Basic Instincts: Static Event Binding Using WithEvents


This month's Basic Instincts column builds upon my last three columns in which I introduced and explained the fundamental concepts and syntax associated with delegates and events. Last month I showed you how to design and write a simple class that defines and raises events.

Ted Pattison

MSDN Magazine March 2003

want to launch modal Popup from created User Event handler




I have a create user wizard on my page and in the event handler (Created User) I get extra information from the user

via textboxes within the aspx etc.


I then do a response.redirect to another page.

What I want to happen is this


When the CreatedUser Event is fired, I  want a Modal Popup to show up with a message Processing your registration.

once the registration code is processed it will close and the users get redirected.


On my ASPX I have the Modal PopUp and a Panel.

In the code behind in the handler I put ModalPop.show()


but this does not work.


thanks for any suggestions



InfoPath Workflow Task Form "Loading" event handler only being called after App Pool recycled.


I have a Workflow that is using an InfoPath task form.  In the "FormEvents_Loading" method event handler I have some code that needs to run each time the form is opened.   I recycle the App Pool and open the form the code runs perfectly, but if I close and try to re-open the form the code is not run at all.  I can then recycle the App Pool again and on the next load the code executes just fine.   The code that is supposed to be run is a very simple statement to set a field value, so I don't think it is interfering.

Does anyone know what this might be?


Event Handler Credentials


I made EH that checks out document when OOB Approval WF is finished successfully.

I want doc to be checked out by WF Initiator, but by default it is made by System Account.

How can i change Event Handler Account ?

Event Binding


Where do i define list affinity of my event?

I though it was "Receivers ListTemplateId" in elements.xml. But when i changed it from 100 (custom list) to 140 and redemployed feature nothing changed. Event still is firing on custom list event and stays still on 140 (workflow history) list events (


<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="140">

Pre_Init event handler problem


Hi all my friends

   I have to masterpages for my home page.

1. The first is for the annonymous users which has the login controls. its name is General_Anonymous.master.

2. The second one is for the logged in users which has a logout button and it hasn't the login controls in it. its name is General_LoggedIn.master.

in my default.aspx page I wrote the following code

protected void Page_PreInit(object sender, EventArgs e)
            if (Session["SupId"] == null && Session["CustomerId"] == null)
                this.MasterPageFile = "~/Masters/General_Anonymous.master";
                this.MasterPageFile = "~/Masters/General_LoggedIn.master";

Binding an event method from a control in a seperate window

How would you bind a event method from a control back to a seperate window?  I have a ActiveX control hosted in a WindowsFormsIntegration wrapper.  That is operating in its own window along with all its events.  The properties of the control are handled by a class that defines the dependency objects (thanks Bob) to provide a view model between it and a window with controls for setting/getting those properties.  Since events constrained to Window 2, is it possible to bind the events back to Window 1?

Binding event or interacting with WorkflowDesignSurface in Workflow Monitor

Is there any way to modify the sample Workflow Monitor class so the user can interact with the diagram, for example;    1) being able to select an activity in the diagram and get back an event of which activity was selected? and/or 2) being able to trigger an if else branch by clicking on the diagram. Any pointers to howtos/tutorials will be helpful, thanks!

Event Handler & AD

My event handler is working fine until i add AD part. After this string it stops firing at all: DirectoryEntry dom = new DirectoryEntry(); I mean it compiles, deploys and doesnt react to anything ( Why ? PS VS2010, SP2010  

Sharepoint 2010 List Added Event Problem

Hi All, I have created List Added Event Handler. In that Event I want to Add Custom Field in List as List is created. I get an Error "The Specified Program Requires    a newer version of windows" Is there ant solution for it. I have tried it also creating new instances of spweb and spsite rather than getting it from "Properties" Thanks Saumil Thakkar

Binding to child list

I have a wpf datagrid that is bound to my business object, Caregivers, which is a custom list of Caregiver.  The Caregiver object contains a child list, ScheduleList, which is a custom list of Schedule. I have successfully bound the datagrid to the Caregivers object using a collectionviewsource and setting the source to my custom object.  I now want to bind the datagrids row details to the child list but I am having trouble.  Here is what I'm trying: My Datagrid is:      <DataGrid Name="DataGridSummary" ItemsSource="{Binding}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" > <DataGridTextColumn Header="Name" Binding="{Binding Name}"/> <DataGrid.RowDetailsTemplate> <DataTemplate> <Border Margin="5" Padding="2" BorderBrush="DimGray" BorderThickness="0" CornerRadius="3"> <DataGrid Name="DataGridDetails" ItemsSource="{Binding ScheduleList}" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray" AutoGenerateColumns="True" CanUserAddRows="False" CanUserDeleteRows="False"> <!--<DataGridTextColumn Header="Clie

text box binding with Generic list

Hi, I am working in asp.net 3.5 page, where I want to bind a textbox with generic list data. And I have Previous & next button. Which will show the record in textbox. I don't want to go in db again and again.  Is it possible.??? 

Data Binding a DataGrid to a list fetch the same data multiple times

Hi, I'm using DataGrid to show data through data binding. My data are provided in a list. The setup I have is the following: DataGrid "binded" to the default view of my list that implement IList<T> and IList interfaces (MyList<T> : IList<T>, IList, INotifyCollectionChanged)             CollectionViewSource.GetDefaultView(_myList);             // Set the data context             DataContext = view; T: is here my 'business object' that hold the data, called 'MyRow'. Then the columns of the DataGrid are bound to public properties of 'MyRow' object. MyRow class has a public property of type 'object' (public object data[int index]) and first column of datagrid is bound to myRow.data[0], second column is bound to myRow.data[1] and so on.   When the datagrid is displayed, databinding kick in and my data are showed in the control. The issue I'm having is that data fetching is very repetitive even for the same rows. For example for a datagrid with 20 visible rows, the first row is fetched multiple times even if the datagrid is not resized or moved. I put break point inside my list (MyList<T> into This[T] property (public T this[int index]) and i got multiple hits into the property for the same index. Fetc
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