asp.net.ph

Repeater.DataBind Method

System.Web.UI.WebControls Namespace   Repeater Class


Binds a data source to a Repeater control.

[ VB ]
Overrides Public Sub DataBind ( )

[ C# ]
public override void DataBind ( );

[ C++ ]
public: void DataBind ( );

[ JScript ]
public override function DataBind ( );

Remarks

Use the DataBind method to bind a DataSource to the Repeater control. Binding the data source with the control enables the information in the data source to be displayed in the Repeater.

The DataBind method is also commonly used to synchronize the data source and a Repeater after information in the data source is updated. This allows any changes in the data source to also be updated in the control.

Example

The below snippet demonstrates how to dynamically bind a data source to a Repeater control when the page loads at run time. The data source in this case is an OleDbDataReader.

<script language = "C#" runat = "server">
   void Page_Load ( Object src, EventArgs e ) {
      // ... code to fetch data into a datareader here ...

      // bind the repeater to the datareader
      myRepeater.DataSource = myReader;
      myRepeater.DataBind ( );

      // close the connection
      myConn.Close ( );
   }
</script>

<asp:repeater id = "myRepeater" runat = "server">
   ...
</asp:repeater>
  C# VB

 Show me 

See Also

Repeater Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph