How Gridview co-operates with ObjectDataSource?

Posted by sanjuro on Stack Overflow See other posts from Stack Overflow or by sanjuro
Published on 2010-03-30T14:02:25Z Indexed on 2010/03/30 14:53 UTC
Read the original article Hit count: 453

Filed under:
|
|
|

Hi, how Gridview co-operates with ObjectDataSource internally? When you set DataSourceID of GridView, assigned ObjectDataSource take care of such things as paging and sorting, but i don't have full control above databinding itself, on the other side when i set datasource of gridview in code-behind:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        testGridView.DataSource = testObjectDataSource.Select();
        testGridView.DataBind();
    }
}

Now i have full control, but i have lost the advantage of comfort sorting and paging. And that co-operation between ObjectDataSource and Gridview became mystery for me. So can anybody explain me in details how ObjectDataSource and Gridview co-operates under the hood? I want to understand it in order to write my own smart code or own gridview that will mimic this co-operation. Many thanks for answers.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET