开发者

How to disable auto data bind of ASP.NET page?

开发者 https://www.devze.com 2023-01-28 21:24 出处:网络
How can I prevent ASP.NET page from automatically binding data controls on the page? I want to increase performance and I want to do binding of each data control based on 开发者_C百科my own order.Simp

How can I prevent ASP.NET page from automatically binding data controls on the page? I want to increase performance and I want to do binding of each data control based on 开发者_C百科my own order.


Simple, don't setup data binding on the controls in the designer.

You would then have to bind the controls inside the code behind part of the page with code.


Not quite what the OP asked for but it is also possible to cancel the Select operation on the Datasource control by adding an event handler to the Selecting event.

public void DataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
    if (CancelSelect())
    {
        e.Cancel=true;
        return;
    }
}
0

精彩评论

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