Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top