Hello Friends
From
SharePoint Event Receivers how could we get the value which has been passed
from querystring?
How can we
achieve this? Here is the sample of code.
public class AddData: SPItemEventReceiver
{
System.Web.HttpContext httpContext = null;
/// <summary>
/// An item
was added.
/// </summary>
public AddData ():base()
{
//get
the httpContext in contsructor, we won't get
//this
outside of this constructor
try
{
httpContext = System.Web.HttpContext.Current;
}
catch
(Exception Ex)
{
}
}
public override void
ItemAdding(SPItemEventProperties properties)
{
if
(httpContext != null)
{
if
(httpContext.Request.QueryString["Data"]
!= null)
{
String strData= httpContext.Request.QueryString["Data "].ToString();
}
}
}
}
Enjoy coding!!!
Disha Shah