What is Page.DataBind doing? For what is this useful?

Discussion in 'ASP .Net' started by Andreas Klemt, Jan 14, 2004.

  1. Hello,
    for what is Page.DataBind useful and what is it doing?

    Thanks for any answer!
    Andreas
     
    Andreas Klemt, Jan 14, 2004
    #1
    1. Advertisements

  2. The methodology in ADO was to loop through data and write it out to the
    stream. In ADO.NET, you bind data instead of looping. Both Windows Forms and
    ASP.NET have data aware controls that can be bound to. For each control that
    can be bound to, there is a DataBind method. For example, a DataGrid:

    DataGrid1.DataSource = MyDataSet.Table["MyTable"].DefaultView;
    DataGrid1.DataBind();

    If you have a lot of controls, rather than bind each individually, you can
    use Page.DataBind(). This tells the rendering engine to find all controls
    with a DataSource and bind them.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    **********************************************************************
    Think Outside the Box!
    **********************************************************************
     
    Cowboy \(Gregory A. Beamer\), Jan 14, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.