Update and read fast a list in Sharepoint

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?


    您可以使用CreateChildControls来初始化您的控件并阅读OnPreRender中的列表。

    链接地址: http://www.djcxy.com/p/57814.html

    上一篇: 无法读取Cookie

    下一篇: 在Sharepoint中更新并快速阅读列表