通常使用AJAX弹出控件扩展器,您只需选择项目,您的选择将填充相关控件。 但是,如果我想直接或通过下拉列表填充控件,那么我想要一个提交按钮和一个取消按钮。 我找到了如何输入提交按钮。但是如何输入取消按钮呢?
<asp:TextBox runat="server" ID="txtWeek1MonAMTimeIn" Width="40px" />
<cc1:PopupControlExtender
ID="PopupControlExtenderWeek1TimeIn" runat="server"
PopupControlID="pnlWeek1MonAMTimeIn"
Position="Bottom"
TargetControlID="txtWeek1MonAMTimeIn"
>
</cc1:PopupControlExtender>
<!-- Panel for editing data -->
<asp:UpdatePanel runat="server" ID="UDPWeek1MonAMTimeIn">
<ContentTemplate>
<asp:Panel runat="server" ID="pnlWeek1MonAMTimeIn" CssClass="popupControl"
onprerender="pnlWeek1MonAMTimeIn_PreRender">
<div class="span-7" style="padding:10px;">
<div>
<div class="span-2">
Time In
</div>
<div class="span-5">
<lib:input runat="server" id="libWeek1MonAMTimeIn" DataType="Time" />
</div>
</div>
<div>
<div class="span-2">
Time Out
</div>
<div class="span-5">
<lib:input runat="server" id="libWeek1MonAMTimeOut" DataType="Time" />
</div>
</div>
<div>
<div class="span-2">
Not in
</div>
<div class="span-5">
<asp:DropDownList runat="server" ID="ddlLeaveWeek1MonAM" />
</div>
</div>
<div>
<div class="span-2">
<asp:Button runat="server" ID="btnCancelWeek1MonAMTimeIn" UseSubmitBehavior="false" Text="Cancel" onclick="btnCancelWeek1MonAMTimeIn_Click" />
</div>
<div class="span-5">
<asp:Button runat="server" ID="btnSubmitWeek1MonAMTimeIn" Text="Submit"
UseSubmitBehavior="false" onclick="btnSubmitWeek1MonAMTimeIn_Click" /></div>
</div>
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
protected void btnSubmitWeek1MonAMTimeIn_Click(object sender, EventArgs e)
{
PopupControlExtender.GetProxyForCurrentPopup(this.Page).Commit(string.Empty);
}
答案 0 :(得分:0)
使用ModalPopupExtender,
它将CancelControlId作为属性
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx