Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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....

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
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. –  Ashish Patel Jan 17 '12 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 –  spStacker Jan 17 '12 at 15:35
    
You can use GetItemById(12)["your name field”] method on your SPList object. –  Ashish Patel Jan 17 '12 at 16:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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