ASP.NET BindingContainer Property

Definition and Usage

The BindingContainer property gets the control that contains the data binding of the current control.

The BindingContainer property contains a reference to the Control object that contains the current control's data binding information.

Tips and Notes

Note:This property supports .NET infrastructure but is not suitable for direct use in code.

Note:The BindingContainer property is the same as the NamingContainer property, except when the control is part of a template. In this case, the BindingContainer property is set to the Control that defines the template.

Example

This example demonstrates the BindingContainer of the button control:

<script runat="server">
Sub Button1_Click(sender As Object, e As EventArgs)
  Response.Write("The binding container is: ")
  Response.Write(button1.BindingContainer)
End Sub
</script>
<form runat="server" >
<asp:Button ID="button1" OnClick="Button1_Click"
Text="Get BindingContainer" runat="server" />
</form>

Example

Displaying the BindingContainer of Button Control