【发布时间】:2018-09-02 09:42:18
【问题描述】:
我正在尝试将值从 ModalPopupExtender 中的列表框传递到父页面中 gridview 页脚行文本框中的文本框。在当前场景中,应用程序在按钮单击时中断。我曾尝试使用 Javascript、juery 和 C#,但所有结果都相同。有人对如何做到这一点有任何建议吗?以下是我的代码:
我正在尝试在完成按钮单击事件“btnSupplierDone_Click”上将值从列表框“lst_PdfViewers”传递到 gridview 文本框“AddSupplierName”
Gridview 页脚行:
<FooterTemplate>
<asp:TextBox ID="AddSupplierName" runat="server" >
</asp:TextBox>
<asp:ImageButton ID="btnlnkSupplier" runat="server" ImageUrl="../images/openDialog20.gif"
onclick ="lnkSupplier_Click" />
</FooterTemplate>
ModalPopupExtender:
<act:ModalPopupExtender ID="ModalPopupExtenderSupplier" CancelControlID="SupplierPopupCancel" TargetControlID="Sample"
PopupControlID="Pnl_Pdfviewers" runat="server" Enabled="true"> </act:ModalPopupExtender>
具有列表框和完成按钮的弹出 div:
<div id="Pnl_Pdfviewers" style="display: none; width: 500px !important; height: 400px !important;"
class="popupConfirmation">
<div class="popup_Titlebar" id="div3">
<div class="TitlebarRight" onclick="$get('SupplierPopupCancel').click();">
</div>
</div>
<div id="div4" class="popup_Container popup_Body" style="overflow: auto; height: 125px;">
<table id="Table2" class="table" style="table-layout: fixed; width: 450px;">
<tr>
<td style="word-wrap: break-word;">
<asp:ListBox ID="lst_PdfViewers" Width="250px" runat="server" OnSelectedIndexChanged="lst_PdfViewers_SelectedIndexChanged"></asp:ListBox>
</td>
</tr>
<tr>
<td style="word-wrap: break-word;">
<%--<input type="button" id="btn1" OnClick="btnSupplierDone_Click" value="Client Button" />--%>
<asp:Button ID="BtnSupplierDone" runat="server" CausesValidation="False" OnClick="btnSupplierDone_Click" Text="Done" />
</td>
</tr>
</table>
</div>
</div>
.cs btnSupplierDone_Click 事件
protected void btnSupplierDone_Click(object sender, EventArgs e)
{
if (lst_PdfViewers.SelectedValue != null)
{
var footerRow = gvPITransactionData.FooterRow;
var txtAddSupplierName = (TextBox)footerRow.FindControl("AddSupplierName");
lst_PdfViewers.SelectedValue = txtAddSupplierName.Text;
// ModalPopupExtenderSupplier.Hide();
}
}
【问题讨论】:
标签: c# asp.net ajax popup modalpopupextender