This is a migrated thread and some comments may be shown as answers.

Routing and Rad Controls

7 Answers 100 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rod
Top achievements
Rank 1
Rod asked on 06 May 2009, 04:50 AM
Hi -

I'm using a simple routing handler (http://chriscavanagh.wordpress.com/2009/01/20/aspnet-routing-in-vbnet/) for a small project.  When I try to place Rad controls such as a menu or combo box on a page, they work fine if the routing indicates the root directory (where the physical page actually is), however if the routing indicates an "interior" page such as "root/About Us/Bios", the Rad links to the AXD file appear to break - I get no CSS and no JavaScript on the controls.  Have you run across similar situations?

Thanks,

Rod

7 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 06 May 2009, 06:28 AM
Hello Rod,

I guess the routing breaks the axd for some reason. Does the built-in ScriptManager control work as expected? I suggest you check for a way to exclude certain paths from routing (which is supported by ASP.NET 3.5 SP1 built-in routing).

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rod
Top achievements
Rank 1
answered on 06 May 2009, 06:35 AM
Thought that must be it.  The handler I downloaded doesn't include an exclude method, so I'll try and work something out.  Are you aware of any routing handler code samples (in VB) that work well with Rad Controls?

Thanks,

Rod
0
Atanas Korchev
Telerik team
answered on 06 May 2009, 06:56 AM
Hi Rod,

We have an ASP.NET MVC Demo (utilizing the routing) which however is implemented in C#. I suggest you check the following pages which explain how to use ASP.NET routing in WebForms applications:

http://msdn.microsoft.com/en-us/magazine/2009.01.extremeaspnet.aspx
http://forums.asp.net/p/1390845/3040518.aspx#3040518
http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rod
Top achievements
Rank 1
answered on 06 May 2009, 07:03 AM
These seem a lot clearer then the one I was using.  Thanks for the help.

Rod
0
Michael
Top achievements
Rank 1
answered on 11 Dec 2009, 06:52 PM
Hi Rod
To simplify, I have on a page RadAjaxPanel with RadGrid inside (Rad controls for asp.net ajax Q1 2009); everything is fine till I'm placing an ajax request - refreshing the grid - then I get this error:

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Global.asax code:
void Application_Start(object sender, EventArgs e) 
    { 
        RegisterRoutes(RouteTable.Routes); 
    } 
 
public static void RegisterRoutes(RouteCollection Routes) 
    { 
        Routes.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler())); 
        var routeHandler = new WebFormRouteHandler<Page>("~/Desktop/Default.aspx"); 
 
        Routes.Add(new Route("pg/{page}", routeHandler)); 
 
    } 


Handler:

public class WebFormRouteHandler<T> : IRouteHandler where T : IHttpHandler, new() 
    { 
        public string VirtualPath { get; set; } 
 
        public WebFormRouteHandler(string virtualPath) 
        { 
            this.VirtualPath = virtualPath
        } 
 
        #region IRouteHandler Members 
 
        public IHttpHandler GetHttpHandler(RequestContext requestContext) 
        { 
            string pageName 
                    = requestContext.RouteData.GetRequiredString("page"); 
            if (!pageName.Contains(".axd") && pageName.Contains(".aspx")) 
            { 
                pageNamepageName = pageName.Replace(".aspx", ""); 
                string virtualPath 
                    = ObjectContentValidator.StringIsNullOrEmpty(pageName) 
                    ? "~/desktop/default.aspx" 
                    : string.Format("~/desktop/default.aspx?page={0}", pageName); 
                HttpContext.Current.RewritePath(virtualPath, false); 
                return (T)BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(T)); 
            } 
            else 
                return (VirtualPath != null) 
                    ? (IHttpHandler)BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(T)) 
                    : new T(); 
        } 
 
        #endregion 
    } 

I didn't send entire application because is huge... It's a portal with single page (default.aspx), with modules (custom controls) loadable at runtime.
If I remove url routing/rewriting everything works fine.
Thank you for your time!

PS: I saw a bug in code editor from current page:
I'm using Firefox (3.5.5) and if I'm trying to edit in code preview section using backspace the tab is closed.
I've done it 3 times till I understood to not use backspace... imagine :))

Cheers!
0
Michael
Top achievements
Rank 1
answered on 16 Dec 2009, 03:59 PM
Hi Albert
Previous post was ment for you (Telerik people :) ); unfortunatelly when I wrote it I was very tired and... imagine I've made a confusion.
It's about post from Dec 11 (asp.net routing & url rewriting). Can you help me with that?
Thanks!
0
Georgi Krustev
Telerik team
answered on 18 Dec 2009, 11:36 AM
Hello Dan,

It is difficult to find what causes this erroneous behavior. I will suggest you open a support ticket and send us a working test project which shows the problem. Thus we will investigate it locally and advice you further.

Best wishes,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Rod
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Rod
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or