【发布时间】:2016-10-13 16:14:13
【问题描述】:
我已经设置好了所有功能,并且功能已经正常工作,一切看起来都很好。只是有一个疑问,我不知道这是否可能。我有一个打开modalpopupextender的按钮,在那里,我有一个表单,它有另一个激活下拉列表的按钮(这是我获取所有信息的地方),单击按钮后,它应该填写所有表格。 问题是,它关闭了modalpopupextender,虽然功能正在完成,但我不想关闭窗口,我的意思是刷新弹出窗口而不关闭它。
这里是……
类.aspx
<asp:Panel ID="panelEmail" Height="680px" Width="800px" runat="server" CssClass="modalPopUp">
<h2>Contact by Email:</h2>
<hr />
<blockquote>
<legend>Pick the template to use: </legend>
<asp:dropdownlist id ="ddlTemplate" runat ="server" Height="23px" Width="436px">
</asp:dropdownlist >
<asp:Button ID="Button1" runat="server" Text="Select" OnClick="Template_Changed" />
<legend>Email Recipient: </legend>
<asp:TextBox ID ="emailT" runat="server" Width="356px" Height="24px" Visible="true" Text="prueba@prueba.com"></asp:TextBox>
<legend>Email Subject: </legend>
<asp:TextBox ID ="title" runat="server" Width="356px" Height="24px" Visible="true" ></asp:TextBox>
<asp:TextBox ID ="txtDetails" runat="server" Width="672px" Height="267px" Visible="true" ></asp:TextBox>
<ajaxToolkit:HtmlEditorExtender ID="TextBox1_HtmlEditorExtender" runat="server" TargetControlID="txtDetails"
EnableSanitization="false" DisplaySourceTab="true" >
</ajaxToolkit:HtmlEditorExtender><br />
<legend>If you want to save the template, name it: (Optional) </legend>
<asp:TextBox ID ="nameTemplate" runat="server" Width="356px" Height="24px" Visible="true" ></asp:TextBox>
<br /><br />
<div align="center">
<asp:Button ID="Button2" runat="server" Text="Send Mail" OnClick="SendMail"/>
<asp:Button ID="Button3" runat="server" Text="Save Template" OnClick="saveTemplate"/>
<asp:Button ID="btnCancelEmail" runat="server" Text="Cancel" CausesValidation="false" />
</div>
</blockquote>
</asp:Panel>
<!-- Código añadido por Enrique Bravo -->
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender4" runat="server"
PopupControlID="panelEmail"
TargetControlID="lnkEmail"
CancelControlID="btnCancelEmail"
BackgroundCssClass="modalBackGround"
DropShadow="true" ></ajaxToolkit:ModalPopupExtender>
<tr id="trEmail">
<td>
<asp:Image ID="Image1" runat="server" ImageUrl ="Images/share.png" width="22px" height="22px" />
</td>
<td align="left" valign="middle">
<asp:LinkButton ID="lnkEmail" runat="server" Text="Email Contact" ></asp:LinkButton>
</td>
</tr>
类.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack){
loadlist();
}
}
public void loadList()
{
if (!this.IsPostBack)
{
try
{
BO.Messages template = new BO.Messages();
ddlTemplate.DataSource = template.GetAll();
ddlTemplate.DataTextField = "Title";
ddlTemplate.DataValueField = "Id";
ddlTemplate.DataBind();
ddlTemplate.SelectedIndexChanged += Template_Changed;
}
catch (Exception e)
{
e.ToString();
}
}
}
/// <summary>
/// Select the correct Message if there has been one template selected
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Template_Changed(object sender, EventArgs e)
{
int countryId = int.Parse(ddlTemplate.SelectedItem.Value);
if (countryId > 0)
{
BO.Messages texto = new BO.Messages();
txtDetails.Text = texto.GetByID(countryId).Body;
title.Text = texto.GetByID(countryId).Subject;
}
}
【问题讨论】:
标签: c# asp.net popup modalpopupextender