Hi
I have a problem in my control. I have 2 controls that named ExplorerDataView and ExplorerGridPanel. ExplorerGridPanel is inherited form GridPanel. I put them on another control named Explorer that inherited from UserControl class then I put it (Explorer control) in content of a panel on an ASCX. When I change visibility of ExplorerGridPanel to false then change it to true again, then click on a row in GridPanel I will receive an unknown error that told me

Server Error in '/App.Diten.Net' Application.
________________________________________
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
Ext.Net.ResourceManager.FireAsyncEvent(String eventName, ParameterCollection extraParams) +126
Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1033
System.Web.UI.<ProcessRequestMainAsync>d__523.Move Next() +8498


________________________________________
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2046.0
 


My code is


protected void ButtonViewIcons_Click(object sender, DirectEventArgs e)
{
Explorer.ViewMode = Explorer.ViewModes.ViewIcons;
Explorer.DataBind();
CenterPanel.Update();
}

protected void ButtonViewDetail_Click(object sender, DirectEventArgs e)
{
Explorer.ViewMode = Explorer.ViewModes.ViewDetail;
Explorer.DataBind();
CenterPanel.Update();
}
public ViewModes ViewMode
{
get => ExplorerGridPanel.Visible ? ViewModes.ViewDetail : iewModes.ViewIcons;
set
{
switch (value)
{
case ViewModes.ViewDetail:
ExplorerDataView.Visible = false;
ExplorerGridPanel.Visible = true;
break;
case ViewModes.ViewIcons:
ExplorerGridPanel.Visible = false;
ExplorerDataView.Visible = true;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}

How can I solve my problem?

Attention!!
There is no problem on ExplorerDataView click event but in ExplorerGridPanel I am receiving this error!!!