.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

ItemAdded event not getting fired

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :SharePoint
Hi, I have ItemAdded event created. I have added a function in that. The function counts the number of files in the subfoldes of the list. I have build the class file, and created it as a feature and activated the feature. I am not sure if my code is being hit. This is the code i have used. [CODE] namespace ItemCountEventHandler {     class Constants     {         public const string url = "Server Name";         public const string listname = "list name";     }     public class ItemCounting : SPItemEventReceiver     {         public override void ItemAdded(SPItemEventProperties properties)         {             //   base.ItemAdded(properties);             GetOpenItems();         }                   public static void GetOpenItems()         {             using (SPSite site = new SPSite(Constants.url))     

View Complete Post

More Related Resource Links

ItemAdded Event


Hi Everyone,

I would like to create a folder in List2 when item added in List1.

Can any one of you guide me how can I achieve this?

Let me know if you have any queires.




Button click event is not fired on button click

 Hi am using jquery flexi gride in web page and it is working fine .But now the problem is ocured when i click button to call server side event.I am not able to find out .Please guide me for this My button is as fallows and i am<asp:Button ID="btnExport" runat="server" Text="Export" Style="font-family: 'Times New Roman', Times, serif" OnClick="btnExport_Click" />  

ItemAdded Event Handler not firing

Hi, I have created an ItemAdded Event handler that is linked to a content type. This event handler does certain custom validations and then sends Email to users. I have referenced this event handler in XML file as well but somehow the event handler is not getting fired...Following is the code.   Code Snippet            this.DisableEventFiring();            using (SPSite site = new SPSite(properties.SiteId))            {                 using (SPWeb web = site.OpenWeb())                {                    base.ItemAdding(properties);                     SPList nList = web.Lists["NList"];                    SPList IList = web.Lists["IList"];                     foreach (SPListItem listItem in nList.Items)                    {                        if (listItem["Topic"].ToString() == properties.ListItem["Topic"].ToString())                        {                            SPUser alertUser = (SPUser)(properties.ListItem["SUser"]);                            SPUtility.SendEmail(web, false, true,alertUser.Email,"New item added", "A new item has been added");                         }                    }                    this.EnableEventFiring();                }            }       The XML file is: Code Snippet  <XmlDocuments>      <XmlDocument NamespaceURI="http://schemas.microsoft.com/

How to retrieve object that fired Command event.

Hi there, My situation is, I have a button that bind with a custom ICommand. When the button is clicked, the "CanExecute()" in the custom ICommand will be execute. The question is, how can I retrieve the button object inside "CanExecute()" ? Thanks. Regards, Rambo Ong

What event (if any) is fired on calling ShowDialog on hidden window

I initialize a window at the launch of my application and hide it, so that when the user needs to launch it I can quickly show it. I am using showDialog to show the window. I use this window at multiple places. So when the user is done using the window I again hide it. My question is how does the window know that it is visible. 'Loaded' event is no longer fired when I can ShowDialog to show the window. ('Loaded' event is fired the first time I create the window and hide it). Is there any other event that is fired on calling 'ShowDialog' on a hidden window? Thanks for your response.  

Will Session_End event will be fired evenif somebody directly closes browser without sign out?

Hi,     In one of my application I m using InProc session state.Can anybody tell me if user closes the browser directly,then Session_End will be called? Regards, Mehul

dont show JS hidden row after server event fired


Hi all,

i designed a gridview named outergrid and within that GV i designed a innerGrid, when the user click on expand button from the outergrid then the inner grid have to show. Now im doing some row filter works using JS, let us assume i have 5 rows in outergrid after filtered first 2 rows will be hiden so now 3 rows displaying, when user clicks on the expand button then im calling RowCommand Event of outergrid now the child grid has populated but the problem is 2 hiden rows(on outergrid) are now visible, how to make these hiden rows not to show while populate innergrid.

createchildcontrols is not fired on page load event


hello frnds

i have develop a custom control as shown below

public class MyControl : System.Web.UI.WebControls.WebControl, INamingContainer


private TextBox txtData ;

protected override void CreateChildControls()
txtData = new TextBox();
txtData.ID = "txtName";



Now, i have placed this control on web page. i also have other asp.net controls like combobox, checkbox etc on this same web page as displayed below. 

<%@ Page Title="" Language="C#" MasterPageFile="~/MyMaster.master" AutoEventWireup="true" CodeFile="Customer.aspx.cs" Inherits="Customer" EnableViewState="true" %>

<asp:Content ID="Content2" ContentPlaceHolderID="PageContent" runat="Server">
    <table cellpadding="0" cellspacing="0" width="100%">
           <td><asp:MyControl ID="CmbMyControl" runat="Server" /></td>

Now in page load ev

How to determine if a loaded event is fired as a result of a navigation button?


I want to perform different actions in my page loaded event based on whether or not the page is being loaded as a result of a navigation button click (ie if the navigation GUI back/forward button was pressed then I want to do A else do B).

Is there a built in flag that I can reference?

Button event not fired


hi all i designed a page like this 

<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
     <asp:UpdateProgress ID="UpdateProgress1" runat="server"
                                    AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="1">

Check box check event not fired properly



 I have 3 Checkbox named as

ParentChk1, ParentChk2, ParentChk3 and i having three childcheckboxlist.

Each ParentChk want to enable corresponding childcheckboxlist.

Now issue is while i am checking  ParentChk1 and ParentChk2 continuously, the ParentChk1 checking event is not fired. 

But if i checking ParentChk2 after few seconds of  checking the ParentChk1 , that checking event trigger properly.


InkCanvas MouseLeftButtonDown event not getting fired


Here I have a very simple problem... i.e i am trying to capure the mouse device with MouseLeftButtonDown event but it seems to be not getting fired...


    private void MyCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      Start = e.MouseDevice.GetPosition(MyCanvas);


    <InkCanvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 

this code is not getting fired please suggest.....

Prabhanjan Kumar Mahapatra

DropDownList SelectedIndexChanged event not fired when programatically setting SelectedValue


In our asp.net web application we load the dropdown list boxes in the page load.  We than set the SelectedValue of each dropdown list box to an object from session.  We have event handlers for many of the SelectedIndexChanged events of the drop down lists boxes, but these do not get executed when we set the selected value programmatically.


Someone else mentioned this is by design, and only when a user manually changes the drop down list selected index, will the event get raised.


I would think this is a common scenario of wanting the selectedindexchanged event handled when setting the selectedvalue/selectedindex/listitem's selected property, of a DropDownList.  What is the suggested way to handle this?  Is there a significant drawback of creating a custom control inherited from DropDownList that has the functionality of raising this event when changing the SelectedIndex or SelectedValue?



Event handler: properties.AfterProperties on a document library ItemUpdated/ItemAdded event


In a ItemUpdated event on a list i normally i use "properties.ListItem" to get data before the changes, and "properties.AfterProperties" to get data after the chages

But when working with document libraries things get a lot complicated. The ItemAdded handler gets called when a file is uploaded, not when the user specifies it's metadata. To handle these metadata i have to use the ItemUpdated handler.
But even there it happens that "properties.ListItem" and "properties.AfterProperties" result both null, so i cannot access any data i need

Is there a way to get a document metadata when it is added to a library?

When MenuItem.NavigateUrl is not set the MenuItemClick event isn't fired!

First of all... I must say "Very good Job guys!!!", this Adapters are great!
In the standard Menu control (without the CSS Friendly Adapter) when we setup menu items without setting the NavigateUrl property, the normal behavior is that at runtime clicking on menu item will fire the MenuItemClick server event.

Using the new CSSFriendly adapter, and leaving null the NavigateUrl property of the menu items, no server event is raised!

IMO this is an incoherent behavior.... do you agree?
Hot to fix this?


file attachment control on infopath 2010 browser form, validating event not fired


If preview within InfoPath 2010, the validating event is fired. But After deploying the form to SharePoint 2010, the validating event does not fire.

Any ideas?


Blog: http://convergingpoint.blogspot.com/

Help with Visual web part - Textchange event not getting fired



I am creating a visual web part. The web part has 2 text box -  Projectid and ChildName. On the textchange event of Projectid, i am trying to fill the cortresponding childName.

This is the code i have used:


 public partial class VisualWebPart1UserControl : UserControl
        public string strConnectionString = "Data Source=Server ip;Initial Catalog=Db Name;User ID=uid;Password=password";

        protected void Page_Load(object sender, EventArgs e)

        protected void fetchInformation()
            SqlDataReader rdr = null;
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
            conn.ConnectionString = strConnectionString;


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