更新用户控件面板无法正常工作 [英] Update panel of User control not working
问题描述
我有一个带有更新面板的用户控件。此更新面板包含国家/地区下拉列表。在选择国家时我必须填写状态下拉列表。
在我的aspx页面中,我已经放置了我的Scripmanager,但是当选择了国家/地区下拉列表时它仍会进行完整的回发。
这是我的主页面设计代码: -
<%@ Master Language =C#AutoEventWireup =trueCodeFile = MasterPage.master.cs
Inherits =NewOneColumnMaster%>
< asp:ContentPlaceHolder ID =metaHolderrunat = 服务器>
这是我的Aspx设计代码: -
Hi, I have a user control with an update panel.This update panel holds country and state dropdown. on selection of country I have to fill state dropdown.
In my aspx page I have placed my Scripmanager but still it does a full postback when country dropdown is selected.
Here is my Master page design code:-
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs"
Inherits="NewOneColumnMaster" %>
<asp:ContentPlaceHolder ID="metaHolder" runat="server">
Here is my Aspx design code:-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyApplication.aspx.vb" Inherits="MyApplication" MasterPageFile="~/MasterPages/NewOneColumnMaster.master" Title="My Application" MaintainScrollPositionOnPostback="true" EnableSessionState="True" %>
<%@ Register src="~/UserControls/MyApplication1.ascx" tagname="Application" tagprefix="uc1" %>
<%@ MasterType VirtualPath="~/MasterPages/NewOneColumnMaster.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PrimaryColumn" runat="Server">
<link href="../css/table.css" rel="stylesheet" type="text/css" />
<form runat="server" id="form1">
<asp:scriptmanager id="ScriptManager1" enablepagemethods="true" enablepartialrendering="true"
runat="server" />
<div id="pageDiv">
<uc1:Applicationid = "ucApplication" runat="server" />
</div>
</form>
</asp:Content>
这是用户控件设计代码: -
Here is User control desgin code:-
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="MyApplication.ascx.vb" Inherits="MyApplication" Debug="true" %>
<div id="MyMainDiv">
<asp:UpdatePanel ID="upEduInfo" runat="server">
<ContentTemplate>
<table>
<tr>
<td style= "height: 22px;">
Country:
</td>
<td colspan="5" style="padding-removed2px;">
<asp:DropDownList ID="drpAltCountry" runat="server" width="300px"
AutoPostBack="True"/>
</td>
</tr>
<tr>
<td style= "height: 22px;">
State/Province:
</td>
<td colspan="5" style="padding-removed2px;">
<asp:DropDownList ID="drpAltState" runat="server" width="300px"/>
</td>
</tr>
</table>
</div>
有谁能建议?谢谢
Can anyone suggest ?? Thanks
推荐答案
你没有在 UpdatePanel [ ^ ]应该触发部分回发,因此DDL的AutoPostBack = true将启动整页发布...
使用 ChildrenAsTriggers [ ^ ]属性,或使用触发器 [ ^ ]声明...
You didn't declared when UpdatePanel[^] should trigger a partial post back, so the AutoPostBack=true of the DDL will initiate full page post...
Use ChildrenAsTriggers[^] property of UpdatePanel, or use Triggers[^] declaration...
如果没有必要,请删除更新面板。
Please remove update panel if it is not necessary.
这篇关于更新用户控件面板无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!