Back to Devexpress

ASPxWebControl.DataBind() Method

aspnet-devexpress-dot-web-dot-aspxwebcontrol-ecdd55f0.md

latest6.1 KB
Original Source

ASPxWebControl.DataBind() Method

Binds the data source to the invoked server control.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public override void DataBind()
vb
Public Overrides Sub DataBind

Remarks

aspx
<dx:ASPxTitleIndex ID="ASPxTitleIndex1" runat="server">
    <!-- ... -->
</dx:ASPxTitleIndex>
csharp
protected void Page_Load(object sender, EventArgs e) {
    string[] names = File.ReadAllLines(Server.MapPath("~/App_Data/customers.txt"), Encoding.Unicode);
    ASPxTitleIndex1.DataSource = names;
    ASPxTitleIndex1.DataBind();
}
vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim names As String() = File.ReadAllLines(Server.MapPath("~/App_Data/customers.txt"), Encoding.Unicode)
    ASPxTitleIndex1.DataSource = names
    ASPxTitleIndex1.DataBind()
End Sub

Note

Up to v2010 vol 2, the DataBind method also binds the data source to the control’s child controls.

View Example: Grid View for ASP.NET Web Forms - How to bind the grid to a data source on a button click

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataBind() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-grid-entitydatasource-and-common-scenarios/CS/GridEntityFramework/CustomEditingCapabilities.aspx.cs#L23

csharp
if (!IsCallback && !IsPostBack) {
    grid.DataBind();
}

asp-net-web-forms-create-responsive-web-app/CS/ResponsiveWebApplication/Article.aspx.cs#L9

csharp
TableOfContentsTreeView.DataBind();
TableOfContentsTreeView.ExpandAll();

asp-net-web-forms-grid-create-master-detail-grid-at-runtime/CS/MasterDetailGrids/Default.aspx.cs#L23

csharp
protected void Page_Load(object sender, EventArgs e) {
    masterGrid.DataBind();
}

asp-net-web-forms-popup-use-one-popup-for-entire-application/CS/T501713/WebForm1.aspx.cs#L28

csharp
};
    grid.DataBind();
}

diagram-for-web-forms-node-and-edge-data-sources-how-to-bind-the-control-to-in-memory-data-sources/CS/DiagramTwoDataSources/DataTableDataBinding.aspx.cs#L20

csharp
Session.Clear();
    Diagram.DataBind();
}

asp-net-web-forms-grid-move-selected-rows-between-grid-controls/VB/E2636/Default.aspx.vb#L46

vb
Next rowValue
    TargetGrid.DataBind()
End If

asp-net-web-forms-grid-entitydatasource-and-common-scenarios/VB/GridEntityFramework/CustomEditingCapabilities.aspx.vb#L23

vb
If Not IsCallback AndAlso Not IsPostBack Then
    grid.DataBind()
End If

asp-net-web-forms-grid-create-master-detail-grid-at-runtime/VB/MasterDetailGrids/Default.aspx.vb#L25

vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    masterGrid.DataBind()
End Sub

asp-net-web-forms-popup-use-one-popup-for-entire-application/VB/T501713/WebForm1.aspx.vb#L28

vb
End Sub
    grid.DataBind()
End Sub

diagram-for-web-forms-node-and-edge-data-sources-how-to-bind-the-control-to-in-memory-data-sources/VB/DiagramTwoDataSources/DataTableDataBinding.aspx.vb#L18

vb
Session.Clear()
    Diagram.DataBind()
End Sub

See Also

ASPxWebControl Class

ASPxWebControl Members

DevExpress.Web Namespace