DataBindingHandlerAttribute Class
.NET Framework 2.0
Specifies a design-time class that performs data binding of controls within a designer. This class cannot be inherited.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
For more information about using attributes, see Extending Metadata Using Attributes.
The following code example defines a data-binding handler, named MyDataBindingHandler, to be used by the designer in editing mode. On exiting the editing mode, the Text property value is displayed.
package CustomControls;
import System.*;
import System.Collections.*;
import System.Web.UI.*;
import System.Web.UI.Design.*;
import System.Web.UI.WebControls.*;
import System.ComponentModel.*;
import System.ComponentModel.Design.*;
/** @attribute DataBindingHandler(MyDataBindingHandler.class)
@attribute ToolboxData("<{0}:MyLabel runat=server></{0}:MyLabel>")
*/
public class MyLabel extends Label
{
public MyLabel()
{
// Insert your code here.
} //MyLabel
} //MyLabel
public class MyDataBindingHandler extends DataBindingHandler
{
public void DataBindControl(IDesignerHost host, Control control)
{
((Label)control).set_Text("Added by data binding handler.");
} //DataBindControl
} //MyDataBindingHandler
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
Community Additions
ADD
Show: