Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Event Receiver:Item is Being Adding Event Recevier Issue

$
0
0

Hi All,

 * I had written Simple event receviers(Item is Being Adding) to a site at FarmLevel(Farm Solution) and below is the code for it.

* In below code I am adding the List name to a Column called "Name" ,when Item is being adding the code is getting loop and inserting unwanted data and updating Column "Name" with it instead of updating when item is added

*Below if u see there is no value in Column "Name" when I insert values "Mark Devis"(Title) and "In Meeting"(Body) columns

Can any one help me how can I solve the issue

       Code:

string listitle = properties.List.Title + "" + "is List Name";
string siteurl = http://sp2010:8080/personal/Sample/;
using (SPSite mysite = new SPSite(siteurl))
{
using (SPWeb myweb = mysite.OpenWeb())
        {

SPList mylist = myweb.Lists["Announcements"];    
SPListItem newitem = mylist.Items.Add();
      newitem["Name"] = listitle.ToString();
      newitem.Update();
         }

  }

Result:

      


Samar




Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>