Redirect When Null Exception Occurs

2 posts, 0 answers
  1. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 04 Mar 2012 Link to this post

    hi

    I have this
    <telerik:ResourceType DataSourceID="sdsResourceItem" KeyField="Resource_ID" 
        Name="ResourceGroup" TextField="Resource_Name" ForeignKeyField="Resource_ID" />
    </ResourceTypes>

    How do i redirect to another page if no Resources are found or empty? Right now i am getting "System.NullReferenceException: Object reference not set to an instance of an object"

    Thanks a lot.
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 06 Mar 2012 Link to this post

    Hi,

    I wonder if handling DataBound of RadScheduler to check the resource count would help you with this case.

    protected void RadScheduler1_DataBound(object sender, EventArgs e)
       {
           Response.Write((sender as RadScheduler).Resources.Count);
       }


    All the best,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top