tags:

views:

57

answers:

2

I have asp.net content page with an update panel, asp.net controls with ajax extenders and it has asp.net button with event click. everything is working ok exept one case. I have 3 DropDownList with CascadingDropDown extenders. when I click the button without selecting anything from DropDownLists then click on the button the event click will work OK but if I select anything my page will respond when I click on the button.

I already I added triggers for click button.

is there anything I should check to fix this problem???

here is my code:

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

I was able to solve the problem.

what I added was to remove the update panel and set the EnableEventValidation="False" for the page.

Eyla
A: 

The issue you're seeing is documented on Codeplex. See jlewicki's post on two other possible solutions that don't require turning off EventValidation.

R0MANARMY

related questions