1

is there any way we can pass parameter value(selected form field value(drop down box) from newform.aspx)to the event receiver(itemadding) from newform.aspx()in sharepoint 2010, so that they can be received using request.querystring['']; in the event receiver code....

1 Answer 1

2

If the dropdown represents one of the column in your list, it should be available as one of the key in properties.AfterProperties.

DISCLAIMER: I have not tried it but since ItemAdding is synchronous event and there is a way to access the HTTPContext in event receivers, you may be able to get to HttpContext.Request.QueryString.

3
  • did you try what I said in Disclaimer? follow the link and in constructor, try tp access Request Query string and store it in a class level variable and the use it in ItemAdding event code. Commented Jan 17, 2012 at 14:55
  • Excellent i was able to get the selected index of the dropdown box using the properties.AfterProperties ..now i want to use this index value "12" and get the corresponding name assicated to it from the look up list .. SPWeb Oweb = properties.OpenWeb(); SPList Olist = Oweb.Lists["AssignmentNames"]; SPListItemCollection OspListItemCollection = Olist.Items; foreach (SPListItem Osplistitem in OspListItemCollection)...but i m not sure how to get the name based on the index that i have..Thanks
    – SandeshR
    Commented Jan 17, 2012 at 15:35
  • 1
    You can use GetItemById(12)["your name field”] method on your SPList object. Commented Jan 17, 2012 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.