在我的代码中,每个droup down都在更新panel.it不回发。对于每个按钮单击完整回发发生。但是我的按钮在更新panel.i尝试触发asynpostback,在这种情况下,服务器端消息不会显示。我也想要那个消息。
我的代码是:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table align="center" style="border: thin solid #FF0000" width="80%">
<tr>
<th colspan="2" align="center" bgcolor="Black" style="color: #FFFFFF">
Schedule New Batch
</th>
</tr>
<tr>
<td colspan="2" align="center">
<div>
<asp:Label ID="lblError" runat="server" Style="font-weight: 700; color: #FF0000;"
Text="Label" Visible="False"></asp:Label>
<asp:Label ID="lblSucess" runat="server" Style="font-weight: 700; color: #006600;
background-color: #FFFFFF;" Text="Label" Visible="False"></asp:Label>
</div>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td class="style44" align="right">
Technology<span class="style23">*</span> :
</td>
<td class="style45">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlTechnology" runat="server" Width="155px" Class="valid" OnSelectedIndexChanged="ddlTechnology_SelectedIndexChanged"
AutoPostBack="True" Height="23px">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="style49" align="right">
Courses<span class="style23">*</span> :
</td>
<td class="style50">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlCourse" runat="server" Width="155px" Class="valid" OnSelectedIndexChanged="ddlCourse_SelectedIndexChanged"
AutoPostBack="True" Height="23px">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="style9" align="right">
Faculty<span class="style23">*</span> :
</td>
<td class="style47">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlFaculty" runat="server" Width="155px" Class="valid" OnSelectedIndexChanged="ddlFaculty_SelectedIndexChanged"
AutoPostBack="True" Height="23px">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="style44" align="right">
Timing<span class="style24">*</span> :
</td>
<td class="style45">
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlTiming" runat="server" Width="155px" Height="23px" AutoPostBack="True"
Class="valid" OnSelectedIndexChanged="ddlTiming_SelectedIndexChanged">
</asp:DropDownList>
<asp:Button ID="btnAdd" runat="server" Text="Add" />
<cc1:modalpopupextender id="btnAdd_ModalPopupExtender" runat="server" cancelcontrolid="btnCancleInsertTime"
dynamicservicepath="" enabled="True" popupcontrolid="Panel1" targetcontrolid="btnAdd">
</cc1:modalpopupextender>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="style44" align="right">
Start Date<span class="style23">*</span> :
</td>
<td class="style45">
<asp:UpdatePanel ID="UpdatePanel6" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtInsertdate" runat="server" Width="150px" Height="16px" Class="valid"></asp:TextBox>
<cc1:calendarextender id="CalendarExtender1" runat="server" targetcontrolid="txtInsertdate"
format="yyyy-MM-dd">
</cc1:calendarextender>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="style51">
</td>
<td class="style45">
</td>
</tr>
<tr>
<td>
<div style="text-align: right">
<asp:Button ID="btnSchedule" runat="server" Text="Schedule" Style="font-weight: 700;
margin-left: 0px;" Width="81px" Height="24px" OnClick="btnSchedule_Click" />
</div>
</td>
<td>
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
<ContentTemplate>
<asp:Button ID="btnreset" runat="server" OnClick="btnreset_Click" Style="font-weight: 700"
Text="Reset" Width="67px" CausesValidation="False" UseSubmitBehavior="false" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnreset" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Panel ID="Panel1" runat="server" aline="center">
<table style="border: thin solid #FF0000; background: #7F8778">
<tr>
<th class="style53">
Please Add a Time
</th>
</tr>
<tr>
<td align="center" style="color: #FF0000" class="style53">
<asp:TextBox ID="txtInsertTime" runat="server" Width="124px"></asp:TextBox>
EX: 09:15AM
</td>
</tr>
<tr>
<asp:UpdatePanel ID="UpdatePanel7" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<td align="center" class="style53">
<asp:Button ID="btnInsertTime" runat="server" Text="Add Time" Width="73px" OnClientClick="return InsertTime()"
OnClick="btnInsertTime_Click" class="cancel" />
<asp:Button ID="btnCancleInsertTime" Text="Cancel" Width="55px" runat="server" class="cancel" />
</td>
</ContentTemplate>
</asp:UpdatePanel>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
<br />
</form>
</asp:Content>
答案 0 :(得分:0)
您可以尝试使用脚本管理器注册该控件,如:
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager1.RegisterAsyncPostBackControl(ddlTechnology);
ScriptManager1.RegisterAsyncPostBackControl(ddlCourse);
}