UpdatePanel的不工作的URL路径选择 [英] updatepanel not working Url routing

查看:174
本文介绍了UpdatePanel的不工作的URL路径选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个有点问题。我回发导致我的asp.net应用程序页面跳回到页面顶部,即使他们更新面板内。结果
当我使用这个路由的UpdatePanel停止工作。

I'm running into a bit of an issue. My postbacks are causing my asp.net application pages to jump back to the top of the page even though they are inside update panels.
when i use this routing updatepanel stop working

   void Application_Start(object sender, EventArgs e)
    {

        RouteTable.Routes.MapPageRoute("UProfile", "{ID}", "~/UProfile.aspx");
    }

但是当我用这个code它工作正常,但我想最简单的网址

but when i use this code it works fine, but i want the simplest URL

   void Application_Start(object sender, EventArgs e)
{

    RouteTable.Routes.MapPageRoute("UProfile", "Users/{ID}", "~/UProfile.aspx");  

我应该如何解决这个问题?
我已经尝试了几个不同的解决方案,没有工作:

how should i solve this problem ? I have tried a couple different solutions, that did not work:

1)http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

2)http://www.iis.net/learn/extensions/url-rewrite-module/url-rewriting-for-aspnet-web-forms

推荐答案

这将路由将目标根URL,因为没有任何特殊标识正确映射。我宁愿建议写一个路由约束,因此您可以决定何时验证传递的参数后,使用用户详细信息页面。
您可以在Asp.net Web表单中添加路由器了。请检查下面的链接。
http://www.shubho.net/2011/02/aspnet-mvp-url-routing-webforms-part3.html

This will route will target root Url because there is no any specific identifier to map it properly. I will rather suggest to write a route constraint so you can decide when to use the user details page after validating the passed parameter. You can add routers in Asp.net Webforms too. Check the following link. http://www.shubho.net/2011/02/aspnet-mvp-url-routing-webforms-part3.html

可能的解决方案将是...

The possible solution would be...

RouteTable.Routes.MapPageRoute("UProfile",
                                "{ID}",
                                "~/UProfile.aspx",
                                false,
                                new RouteValueDictionary { { "ID", "1" } }, new RouteValueDictionary { { "ID", "[\d]+" } });

这篇关于UpdatePanel的不工作的URL路径选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆