2010-03-16 54 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」。