Built-in onClick handler fails when tab strip not visible.

3 posts, 1 answers
  1. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 19 Apr 2008 Link to this post

    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.

    [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:

    1 <%@ Page Language="VB" %> 
    3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    5 <script runat="server"
    7     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
    8         MainContent.Visible = Not ToBeHidden.Checked 
    9     End Sub 
    11 </script> 
    13 <html xmlns="http://www.w3.org/1999/xhtml"
    14 <head runat="server"
    15     <title>Untitled Page</title> 
    16 </head> 
    17 <body> 
    18     <form id="form1" runat="server"
    19     <div id="MainContent" runat="server"
    21     <asp:ScriptManager ID="SM1" runat="server" /> 
    23         <asp:CheckBox ID="ToBeHidden" runat="server" Text="Hide Me" /> 
    25         <telerik:RadTabStrip ID="TabStrip1" AutoPostBack="true" MultiPageID="MP1" runat="server" > 
    26             <Tabs> 
    27                 <telerik:RadTab Text="Tab 1" Value="1" PageViewID="PV1" /> 
    28                 <telerik:RadTab Text="Tab 2" Value="2" PageViewID="PV2" /> 
    29                 <telerik:RadTab Text="Tab 3" Value="3" PageViewID="PV3" /> 
    30                 <telerik:RadTab Text="Tab 4" Value="4" PageViewID="PV4" /> 
    31                 <telerik:RadTab Text="Tab 5" Value="5" PageViewID="PV5" /> 
    32             </Tabs> 
    33         </telerik:RadTabStrip> 
    35         <telerik:RadMultiPage ID="MP1" RenderSelectedPageOnly="false" runat="server" > 
    37             <telerik:RadPageView ID="PV1" runat="server"
    38                 <h1>Page View 1</h1> 
    39             </telerik:RadPageView> 
    41             <telerik:RadPageView ID="PV2" runat="server"
    42                 <h1>Page View 2</h1> 
    43             </telerik:RadPageView> 
    45             <telerik:RadPageView ID="PV3" runat="server"
    46                 <h1>Page View 3</h1> 
    47             </telerik:RadPageView> 
    49             <telerik:RadPageView ID="PV4" runat="server"
    50                 <h1>Page View 4</h1> 
    51             </telerik:RadPageView> 
    53             <telerik:RadPageView ID="PV5" runat="server"
    54                 <h1>Page View 5</h1> 
    55             </telerik:RadPageView> 
    57         </telerik:RadMultiPage> 
    59     </div> 
    60     </form> 
    61 </body> 
    62 </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.
  2. Answer
    Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 21 Apr 2008 Link to this post

    Hello Barry,

    Unfortunately you seem to have discovered another bug in RadTabStrip for ASP.NET Ajax. It was also fixed - please open a support ticket to obtain the hotfix.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 22 Apr 2008 Link to this post

    I have to say that I continue to love Telerik!  Your software and your support go hand-in-hand as top-of-the-line. 

    This problem was quickly identified, corrected, and I got a hotfix all within 24-hours.

    Thank you so much!
Back to Top