2 xiamoxiaoyu xiamoxiaoyu 于 2014.07.29 17:23 提问

UrlRouting和UpdatePanel 使用了UrlRouting导致UpdatePanel 不起作用

注册url路由之后,整个项目的UpdatePanel 都不起作用,都变成刷新了,求大神解救啊
这是我的注册路由代码:
///
/// 注册路由
///
/// 路由集合
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute(
"index",
"",
"~/content/index.aspx"
);
routes.MapPageRoute(
"whois",
"whois",
"~/content/whois.aspx"
);
routes.MapPageRoute(
"alexa",
"alexa",
"~/content/alexa.aspx"
);
routes.MapPageRoute(
"history",
"history",
"~/content/history.aspx"
);
routes.MapPageRoute(
"reverse",
"reverse",
"~/content/reverse.aspx"
);
routes.MapPageRoute(
"pr",
"pr",
"~/content/pr.aspx"
);

        routes.MapPageRoute(
            "whois参数",
            "{parm1}",
            "~/content/index.aspx"
        );

        routes.MapPageRoute(
       "一级目录页 参数1",
       "{page}/{parm1}",
       "~/content/{page}.aspx"
       );
    }

这是updatepanel 页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Web.content.WebForm1" %>

<!DOCTYPE html>




<pre><code> Sys.Application.add_load(function () { var form = Sys.WebForms.PageRequestManager.getInstance()._form; form._initialAction = form.action = window.location.href; }); &lt;/script&gt; </code></pre> <p></head><br> <body><br> <form id="form1" runat="server"><br> <div id="divmessage"></p> <pre><code>&lt;/div&gt; &lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot;&gt;&lt;/asp:ScriptManager&gt; &lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot; &gt; &lt;ContentTemplate&gt; &lt;asp:Button ID=&quot;Button3&quot; runat=&quot;server&quot; Text=&quot;测试是否刷新&quot; OnClick=&quot;Button3_Click&quot; /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:UpdatePanel ID=&quot;UpdatePanel2&quot; runat=&quot;server&quot; &gt; &lt;ContentTemplate&gt; &lt;asp:Button ID=&quot;Button2&quot; runat=&quot;server&quot; Text=&quot;测试2&quot; OnClick=&quot;Button2_Click&quot; style=&quot;height: 21px&quot; CausesValidation=&quot;false&quot; /&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:PostBackTrigger ControlID=&quot;Button2&quot; /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/form&gt; </code></pre> <p></body><br> </html></p>
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!