我有一个带有更新面板的asp.net内容页面,带有ajax扩展器的asp.net控件,还有带有事件点击的asp.net按钮。除了一个案例之外,一切都很正常。我有3个带CascadingDropDown扩展器的DropDownList。当我在没有从DropDownLists中选择任何东西的情况下点击按钮,然后点击按钮,事件点击将正常工作,但是如果我选择了任何东西,当我点击按钮时,我的页面将会响应。
我已经为点击按钮添加了触发器。
有什么我应该检查来解决这个问题的吗?
下面是我的代码:
<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="IMAM_APPLICATION.WebForm2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
<asp:UpdatePanel ID="UPDDL" runat="server">
<ContentTemplate>
<asp:Panel ID="PDDL" runat="server">
<asp:DropDownList ID="cmbWorkField" runat="server" Style="top: 41px; left: 126px;
position: absolute; height: 22px; width: 126px">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="cmbOccupation" Style="top: 77px; left: 127px;
position: absolute; height: 22px; width: 77px">
</asp:DropDownList>
<asp:DropDownList ID="cmbSubOccup" runat="server"
style="position:absolute; top: 116px; left: 126px;">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cmbWorkField_CascadingDropDown" runat="server"
TargetControlID="cmbWorkField"
Category="WorkField"
LoadingText="Please Wait ..."
PromptText="Select Wor kField ..."
ServiceMethod="GetWorkField"
ServicePath="ServiceTags.asmx">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="cmbOccupation_CascadingDropDown" runat="server"
TargetControlID="cmbOccupation"
Category="Occup"
LoadingText="Please wait..."
PromptText="Select Occup ..."
ServiceMethod="GetOccup"
ServicePath="ServiceTags.asmx"
ParentControlID="cmbWorkField">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="cmbSubOccup_CascadingDropDown" runat="server"
Category="SubOccup"
Enabled="True"
LoadingText="Please Wait..."
ParentControlID="cmbOccupation"
PromptText="Select Sub Occup"
ServiceMethod="GetSubOccup"
ServicePath="ServiceTags.asmx"
TargetControlID="cmbSubOccup">
</cc1:CascadingDropDown>
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
........................
here is the code behind:
....................................................
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "you click me";
}发布于 2010-03-22 11:09:37
我能够解决这个问题。
我添加的是删除更新面板,并将页面的EnableEventValidation=设置为“False”。
发布于 2010-04-04 23:44:46
您看到的问题记录在Codeplex上。请参阅jlewicki的帖子,了解其他两种不需要关闭EventValidation的可能解决方案。
https://stackoverflow.com/questions/2457241
复制相似问题