aspnet-403749-troubleshooting-server-side-issues-target-did-not-implement-icallbackeventhandler.md
This error occurs for a parent control or its child controls if the parent control is created at runtime.
Follow the steps below when you create a control/WebUserControl at runtime:
Use a control’s constructor or call the LoadControl method with a virtual path to a web user control (*.acsx file) as a parameter to create/load a control or WebUserControl.
Specify the control’s ID property.
Specify the control’s SkinID and EnableTheming properties (optional).
Attach event handlers (if required).
Insert the control into the control hierarchy.
Specify the control’s properties.
Bind the control (for data-aware controls).
protected void Page_Init(object sender, EventArgs e) {
if (Session["Loaded"] != null) {
LoadUserControl();
}
}
protected void ASPxCallbackPanel1_Callback(object source, DevExpress.Web.CallbackEventArgsBase e) {
if (e.Parameter == "Show") {
LoadUserControl();
Session["Loaded"] = true;
}
else {
UnloadUserControl();
Session.Remove("Loaded");
}
}
protected void LoadUserControl() {
Control control = LoadControl("~/DataViewUserControl.ascx");
control.ID = "uc";
ASPxCallbackPanel1.Controls.Add(control);
}
protected void UnloadUserControl() {
ASPxCallbackPanel1.Controls.Clear();
}
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
If Session("Loaded") IsNot Nothing Then
LoadUserControl()
End If
End Sub
Protected Sub ASPxCallbackPanel1_Callback(ByVal source As Object, ByVal e As DevExpress.Web.CallbackEventArgsBase)
If e.Parameter = "Show" Then
LoadUserControl()
Session("Loaded") = True
Else
UnloadUserControl()
Session.Remove("Loaded")
End If
End Sub
Protected Sub LoadUserControl()
Dim control As Control = LoadControl("~/DataViewUserControl.ascx")
control.ID = "uc"
ASPxCallbackPanel1.Controls.Add(control)
End Sub
Protected Sub UnloadUserControl()
ASPxCallbackPanel1.Controls.Clear()
End Sub