2

I have an event receiver(item adding,item added)..on a custom list..this event receiver creates an ID when a new item is created..so when i deactivate the event receiver and add a new item to the list it adds it with empty ticketID(since no event receiver, no ticket id is generated)... so is there any way where the newform.aspx before saving will know if the event receiver is activated or deactivated, so if its deactivated it wud not let to add new item and throw error.. any suggestions?

1

You can implement below logic:

You can have list 'read only' when feature\eventreceiver is de-activated or not installed. On activating, grant contribute rights to the list.

This way you ensure that items can only be created when feature\eventreceiver is active.

2

Just throwing an idea...

You may write write a web part, all it does is check if event receiver is attached to List in context (SPContext.Current.List.EventReceivers collection). If not, redirect to an error page about invalid list configuration. And drop the webpart on the page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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