我是ASP.Net的新手。我正在使用VS 2010并且目标是.net 4.0框架。我正在使用ajaxtoolkit,我的网站启用了ajax。我有一个奇怪的问题。我没有得到第一次服务器按钮单击的按钮单击事件。在此内部page_load期间,Postback属性为false。有趣的是,如果导航到我的网站的任何其他页面回来并做同样的事情,一切正常(意味着我得到按钮点击事件)。我第一次不知道发生了什么问题。另一件有趣的事情是,如果我从我的机器(运行IIS的计算机)进行测试,则没有问题。但是问题可以通过不同计算机中的浏览器生成。我只是坐着没有任何线索。有人可以帮助我吗?
我的代码如下所示。由于版权问题,我无法提供完整的源代码。我完全被这个问题所困扰。请帮帮我
<%@ Page Title="TestPage" Language="C#" MasterPageFile="~/MenuMaster.master" AutoEventWireup="true"
CodeBehind="TestPage.aspx.cs" Inherits="TestApp"
EnableEventValidation="false"
%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="ControlContent">
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblProductGroup" runat="server" Text="ProductGroup></asp:Label>
</div>
<div class="controlValue1">
<asp:DropDownList ID="cmbProductGroup" runat="server" Width="120px">
</asp:DropDownList>
</div>
</div>
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblProduct" runat="server" Text="Product"></asp:Label>
</div>
<div class="controlValue1">
<asp:DropDownList ID="cmbProduct" runat="server" Width="120px">
</asp:DropDownList>
</div>
</div>
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblSvcOptName" runat="server" Text="Option"></asp:Label>
</div>
<div class="controlValue1">
<asp:DropDownList ID="cmbSvcOption" runat="server" Width="120px">
</asp:DropDownList>
</div>
<div class="controlValue2">
<asp:Button ID="btnAddToCart" runat="server" Text="Add To Cart" OnClick="btnAddToCart_Click" />
</div>
</div>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDownForProductGroup" runat="server" TargetControlID="cmbProductGroup"
Category="ProductGroup" LoadingText="[Loading ProductGroup...]" ServiceMethod="GetDropDownContentsBasedOnSelection" />
<ajaxToolkit:CascadingDropDown ID="CascadingDropDownForProduct" runat="server" TargetControlID="cmbProduct"
Category="Product" LoadingText="[Loading Products...]" ServiceMethod="GetDropDownContentsBasedOnSelection"
ParentControlID="cmbProductGroup" />
<ajaxToolkit:CascadingDropDown ID="CascadingDropDownForSvcOptions" runat="server"
TargetControlID="cmbSvcOption" Category="Option" LoadingText="[Loading Options...]"
ServiceMethod="GetDropDownContentsBasedOnSelection" ParentControlID="cmbProduct" />
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblSerialNumber" runat="server" Text="Serial Number"></asp:Label>
</div>
<div class="controlValue1">
<asp:TextBox ID="txtSerialNumber" runat="server" Text="123456789" Width="120px"></asp:TextBox>
</div>
<div class="controlValidator">
<asp:RequiredFieldValidator ID="serialNumReqFieldValidator" runat="server"
ErrorMessage="Please enter serial number" ControlToValidate="txtSerialNumber">*</asp:RequiredFieldValidator>
</div>
</div>
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblExpiryDate" runat="server" Text="Expiry Date"></asp:Label>
</div>
<div class="controlValue1">
<asp:TextBox ID="txtExpDate" runat="server" Width="120px"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="expiryDateCalendarExtender" runat="server" TargetControlID="txtExpDate"
PopupButtonID="calendarImage" />
</div>
<div class="controlValue2">
<asp:ImageButton ID="calendarImage" runat="Server" ImageUrl="~/Images/Calendar_scheduleHS.png"
AlternateText="Click to show calendar" />
</div>
<div class="controlValidator">
<asp:RequiredFieldValidator ID="expDateReqFieldValidator" runat="server" ErrorMessage="Please enter a date" ControlToValidate="txtExpDate">*</asp:RequiredFieldValidator>
<asp:CustomValidator ID="expDateValidator" runat="server" ControlToValidate="txtExpDate"
ErrorMessage="Please enter a valid date" OnServerValidate="expDateValidator_ServerValidate">*</asp:CustomValidator>
</div>
</div>
<asp:UpdatePanel ID="CartUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblSelOptions" runat="server" Text="Options In Cart"></asp:Label>
</div>
<div class="controlValue1">
<asp:ListBox ID="lstBoxSvcOptions" runat="server" Width="120px"></asp:ListBox>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddToCart" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnClearCart" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<div class="controlWrapper">
<div class="controlLabel">
<asp:Label ID="lblGenKey" runat="server" Text="Generated Key"></asp:Label>
</div>
<div class="controlValue1">
<asp:TextBox ID="txtKeyGenerated" runat="server" Width="120px" ReadOnly="True"></asp:TextBox>
</div>
</div>
<div class="controlWrapper">
<div class="valSummary">
<asp:ValidationSummary ID="validationSummary1" runat="server" />
</div>
</div>
<div class="controlWrapper">
<div class="valSummary">
<asp:Label ID="lblOprStatus" runat="server"></asp:Label>
</div>
</div>
<div class="controlWrapper">
<div class="ThreeButton">
<asp:Button ID="btnGenKey" runat="server" Text="Generate Key" OnClick="btnGenKey_Click" />
</div>
<div class="ThreeButton">
<asp:Button ID="btnGenKeyFile" runat="server" Text="Generate Key File" OnClick="btnGenKeyFile_Click" />
</div>
<div class="ThreeButton">
<asp:Button ID="btnClearCart" runat="server" Text="Clear Cart" OnClick="btnClearCart_Click" />
</div>
</div>
</asp:Content>