开发者

Save Conflict Error when trying to add new List Items at the time of list creation

开发者 https://www.devze.com 2023-01-02 08:28 出处:网络
We have created a Custom List template programmatically using Feature.xml, Element.xml, Schema.xml AllItems.aspx, and 3 aspx forms. We have a code behind file for each of these aspx files. i.e. for th

We have created a Custom List template programmatically using Feature.xml, Element.xml, Schema.xml AllItems.aspx, and 3 aspx forms. We have a code behind file for each of these aspx files. i.e. for the AllItems.aspx, DispForm.aspx, EditForm.aspx and NewForm.aspx.

Problematic file is AllItems.aspx. In the code behind for AllItems.aspx file we are deleting previous list items and adding new items to the list before showing them up to the user. As per expectations the code behind file for AllItems.aspx is derived from WebPartPage Class and we have tried to overload quite a few methods without much success.

Problem only occurs on the first time rendering i.e. when an instance of this list is created. When overriding OnLoad(), we get the Save conflict error, Similar is the case with OnInit(), CreateChildControls() method. However, when we override the Render() or RenderChildren() method no such error comes up but at the same time our new list items are also not visible. On开发者_如何学Python browser refresh everything starts working fine as expected. It is only for the first time that the issue comes up.

What could be the possible cause for this? Any ideas, suggestions would be highly appreciated.

Best Regards,

Raghu


I had a problem with a custom EditForm.aspx. I have two lists that are linked together and a change in one causes an event handler to update the other. I have a custom control in EditForm.aspx that edits the linked list. This was causing the event handler to update the item displayed by EditForm.aspx. This in turn would cause the conflict error when the user saved the form.

I finally found that I could reset the context with:

SPContext.Current.ResetItem();

I am not sure if this will help in your case but it fixed my problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号