2010-03-16 55 views
0

我有一个更新面板的asp.net内容页面,带有Ajax扩展器的asp.net控件,它具有事件点击的asp.net按钮。 一切工作正常,免除一例。 我有3个DropDownList与CascadingDropDown扩展。当我点击按钮而没有从DropDownLists中选择任何东西,然后点击按钮,事件点击就可以正常工作,但是如果我选择了任何我点击该按钮时页面将会响应的东西。asp.net内容页面有问题CascadingDropDown

我已经添加了点击按钮的触发器。

有什么我应该检查解决这个问题?

这里是我的代码:

<%@ 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"; 
     } 

回答

0

我能解决这个问题。

我添加的是删除更新面板,并为页面设置EnableEventValidation =“False”。