执行服务器端code对ModalPopupExtender okcontrolid点击 [英] Execute server side code on ModalPopupExtender okcontrolid clicked
问题描述
我使用ASP.NET和C#。我想弹出这个小屏幕,然后单击确定按钮时,我想根据输入的弹出更新主屏幕。听起来像它应该是经常的事情。是否有可能,如果是这样,怎么样?
I am using ASP.NET and C#. I want to popup this little screen, then when the OK button is clicked, I want to update the main screen based on the input to the popup. Sounds like it should be a regular thing. Is it possible, and if so, how?
<cc1:modalpopupextender id="ModalPopupExtender1" runat="server"
cancelcontrolid="btnCancel" okcontrolid="btnOkay"
targetcontrolid="txtCosCodeExpCode" popupcontrolid="Panel1"
popupdraghandlecontrolid="PopupHeader" drag="true"
backgroundcssclass="ModalPopupBG">
</cc1:modalpopupextender>
<asp:panel id="Panel1" style="display: none" runat="server">
<div class="CostCentreExpenseCodePopup" style="background-color:White ; border-style :solid;">
<div class="PopupHeader" id="PopupHeader">Select Cost Centre / Expense Code</div>
<div class="PopupBody">
<p>Cost Centre<asp:DropDownList
ID="ddlCostCentres1"
runat="server"
CssClass="SVSComboBox1"
AppendDataBoundItems ="True"
AutoPostBack="True"
style = "width :152px;"
OnSelectedIndexChanged="ddlCostCentres1_SelectedIndexChanged">
<asp:ListItem Text="Please select" Value="0"></asp:ListItem>
</asp:DropDownList></p>
<p>Expense Code <asp:DropDownList ID="ddlExpCode1" runat="server" CssClass="SVSComboBox1" style = "width :152px;"
AppendDataBoundItems ="True" Enabled="False" Visible ="False">
<asp:ListItem Text="Please select" Value="0"></asp:ListItem>
</asp:DropDownList></p>
</div>
<div class="Controls">
<input id="btnOkay" type="button" value="Done" />
<input id="btnCancel" type="button" value="Cancel" />
</div>
</div>
推荐答案
不要设置 OkControlID
,但使用 ModalPopupExtender1.Hide()
服务器端。然后,你可以先打电话给你的最新情况:code。
Don't set OkControlID
but use ModalPopupExtender1.Hide()
on server-side. Then you're able to call your update-code first.
您也应该使用服务器按钮,而不是&LT;输入ID =btnOkay类型=按钮值=完成/&GT;
和处理他们的点击-event。
You should also use server-buttons instead of <input id="btnOkay" type="button" value="Done" />
and handle their click-event.
这篇关于执行服务器端code对ModalPopupExtender okcontrolid点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!