开发者

Update and read fast a list in Sharepoint

开发者 https://www.devze.com 2023-03-09 01:15 出处:网络
I have a webpart with this behaviour: When it loads, it reads a Sharepoint list, and then shows a popup message.

I have a webpart with this behaviour:

  • When it loads, it reads a Sharepoint list, and then shows a popup message.
  • When I accept the message, then the Webpart updates the list.

To read the value I have a function inside CreateChildControls

protected override void CreateChildControls() {
readList()
... 
otherStuff
}

and to save the value I have a hiddenField, that executes the save function when changes the value:

hiddenField.ValueChanged += new System.EventHandler(functionThatSavesTheValue);

Then when the user accept the message of the popup, I change the value of the hiddenField via javascript, to execute the functionThatSavesTheValue

button.value = '1' + button.value;

Since here, all works fine.

The problem is if I reload the page just after push the button.

In that case, the function that reads the list开发者_运维问答 executes before the function that saves the value, and I get wrong values. What can I do to fix this?


You could use CreateChildControls to initialize your controls and read the list in OnPreRender.

0

精彩评论

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