How to disable automatic data binding to an ASP.NET page?

How can I prevent an ASP.NET page from automatically binding data controls to a page? I want to improve performance, and I want to bind each data control based on my own order.

+5
source share
2 answers

Simple, do not set data binding to controls in the constructor.

Then you will need to link the controls inside the code behind the part of the page with the code.

+7
source

Not quite what the OP requested, but you can also 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;
    }
}
+2

All Articles