What do you do when you can't use ViewState?

后端 未结 7 1791
长发绾君心
长发绾君心 2021-02-09 06:43

I have a rather complex page that dynamically builds user controls inside of a repeater. This repeater must be bound during the Init page event before ViewState is

7条回答
  •  滥情空心
    2021-02-09 07:18

    protected override void LoadViewState(object savedState)
    {
       // Put your code here before base is called
       base.LoadViewState(savedState);
    }
    

    Is that what you meant? Or did you mean in what order are the controls processed? I think the answer to that is it quasi-random.

    Also, why can't you load the objects you bind to before Page_Load? It's ok to call your business layer at any time during the page lifecycle if you have to, with the exception of pre-render and anything after.

提交回复
热议问题