UpdatePanel和母版页中的两个内容占位符区域
|
我有一个“旧版” ASP.NET网站,我想对其进行一些改进。我想做的一件事是页面更新-目前,它始终是整页更新,但是我想开始使用部分更新。
我希望能够为此使用ASP.NET
UpdatePanel
-但是我对如何使它对我有效有些困惑。
我有一个母版页,它定义了几个内容占位符-简化后看起来像这样:
<%@ Master Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"Default.master.cs\" Inherits=\"WebForms_Default\" %>
<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head runat=\"server\">
<title>MyTitle</title>
</head>
<body>
<form id=\"myForm\" runat=\"server\">
<asp:ScriptManager ID=\"smgrMaster\" runat=\"server\" LoadScriptsBeforeUI=\"true\">
<Scripts>
<asp:ScriptReference Path=\"~/Scripts/jquery-1.4.2.min.js\" />
</Scripts>
</asp:ScriptManager>
<asp:ContentPlaceHolder runat=\"server\" ID=\"cphSearch\" />
<asp:ContentPlaceHolder runat=\"server\" ID=\"cphContent\" />
</form>
</body>
</html>
在内容页面上,网格显示cphContent
区域内的数据-在cphSearch
区域中,我有许多输入控件-RadioButtonList
和两个DropDowns
。只要这些控件中的任何内容发生更改,就暂时发出回发(设置为AutoPostback=\"true\"
)。
我的问题是:如何将我的UpdatePanel
(我想在cphContent
区域中的网格周围包裹)告诉“听”来自“ 3 for的这三个控件的回发?
<asp:UpdatePanel>
<ContentTemplate>
<asp:GridView>
// grid view defined here
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID=\".. what values to put here?? ..\" />
<asp:PostBackTrigger ControlID=\".. - what values to put here?? ..\" />
</Triggers>
当我添加<asp:UpdatePanel>
时,会得到一个<Triggers>
部分,但是cphSearch
内容区域中的那些控件不可见,所以我想我真的不能将它们添加为更新触发器,对吗?
我完全没有得到它(绝对有可能!),或者我错过了一个明显的步骤/技巧来使它起作用-否则这是不可能的。让我知道!
没有找到相关结果
已邀请:
2 个回复
戊袱
找到控制权时,不必一直将
放在某个事件上,只需使用没有ѭ16的updatepanel
这将更新整个网格,搜索控件,并且还将处理AutoPostBack事件,但dnt忘记放置Update
控件以查看工作正在进行中...
联课