This may be related to my other post Selected Tab lost when PageView set not to render. I've found that when you click on a tab, the built-in event handler fails with a null reference exception.
My main problem with this is that I have pages that check for authorized access every time they are loaded. If the user has attempted to access a function for which they are not authorized, my base page class hides the main content window and replaces it with an "Unauthorized Access" message (or takes some other appropriate action). In my own event handlers, I check to see if the user/action is authorized (since the event handlers still fire) and simply don't perform the task if the authorization check fails.
I had no problems with this using the old tab strip. With the upgrade to the tabstrip in RadControls for ASP.Net Ajax, it seems not to like it if the tabs are hidden during the built-in click handling.
I've spent several hours now trying to track this down, wondering just what changed in my application, and I was able to narrow it down to the built-in tab event handling with the following page code:
In this example, all I've done is add a checkbox (line 23) that turns visible="false" for the MainContent div (line 19). With the checkbox cleared, and as such the content remaining visible, you can click on the tabs to your heart's content. However, if you check the box and click any tab, the page loads, the MainContent area is hidden, and the built-in event handler fails with the null reference exception. I further tested the fact that it's the event handler by simply setting the MainContent div to hidden in the Page_Load and just loaded the page and there was no error. No content visible, of course, but also no error.
Thank you again for looking into this.
[NullReferenceException: Object reference not set to an instance of an object.] |
Telerik.Web.UI.RadTabStrip.PerformValidation(RadTab tab) +167 |
Telerik.Web.UI.RadTabStrip.RaisePostBackEvent(String eventArgument) +53 |
Telerik.Web.UI.RadTabStrip.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 |
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 |
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177 |
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746 |
My main problem with this is that I have pages that check for authorized access every time they are loaded. If the user has attempted to access a function for which they are not authorized, my base page class hides the main content window and replaces it with an "Unauthorized Access" message (or takes some other appropriate action). In my own event handlers, I check to see if the user/action is authorized (since the event handlers still fire) and simply don't perform the task if the authorization check fails.
I had no problems with this using the old tab strip. With the upgrade to the tabstrip in RadControls for ASP.Net Ajax, it seems not to like it if the tabs are hidden during the built-in click handling.
I've spent several hours now trying to track this down, wondering just what changed in my application, and I was able to narrow it down to the built-in tab event handling with the following page code:
<%@ Page Language="VB" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<script runat="server"> | |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) | |
MainContent.Visible = Not ToBeHidden.Checked | |
End Sub | |
</script> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title>Untitled Page</title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div id="MainContent" runat="server"> | |
<asp:ScriptManager ID="SM1" runat="server" /> | |
<asp:CheckBox ID="ToBeHidden" runat="server" Text="Hide Me" /> | |
<telerik:RadTabStrip ID="TabStrip1" AutoPostBack="true" MultiPageID="MP1" runat="server" > | |
<Tabs> | |
<telerik:RadTab Text="Tab 1" Value="1" PageViewID="PV1" /> | |
<telerik:RadTab Text="Tab 2" Value="2" PageViewID="PV2" /> | |
<telerik:RadTab Text="Tab 3" Value="3" PageViewID="PV3" /> | |
<telerik:RadTab Text="Tab 4" Value="4" PageViewID="PV4" /> | |
<telerik:RadTab Text="Tab 5" Value="5" PageViewID="PV5" /> | |
</Tabs> | |
</telerik:RadTabStrip> | |
<telerik:RadMultiPage ID="MP1" RenderSelectedPageOnly="false" runat="server" > | |
<telerik:RadPageView ID="PV1" runat="server"> | |
<h1>Page View 1</h1> | |
</telerik:RadPageView> | |
<telerik:RadPageView ID="PV2" runat="server"> | |
<h1>Page View 2</h1> | |
</telerik:RadPageView> | |
<telerik:RadPageView ID="PV3" runat="server"> | |
<h1>Page View 3</h1> | |
</telerik:RadPageView> | |
<telerik:RadPageView ID="PV4" runat="server"> | |
<h1>Page View 4</h1> | |
</telerik:RadPageView> | |
<telerik:RadPageView ID="PV5" runat="server"> | |
<h1>Page View 5</h1> | |
</telerik:RadPageView> | |
</telerik:RadMultiPage> | |
</div> | |
</form> | |
</body> | |
</html> | |
In this example, all I've done is add a checkbox (line 23) that turns visible="false" for the MainContent div (line 19). With the checkbox cleared, and as such the content remaining visible, you can click on the tabs to your heart's content. However, if you check the box and click any tab, the page loads, the MainContent area is hidden, and the built-in event handler fails with the null reference exception. I further tested the fact that it's the event handler by simply setting the MainContent div to hidden in the Page_Load and just loaded the page and there was no error. No content visible, of course, but also no error.
Thank you again for looking into this.