我正在尝试将值从ModalPopupExtender中的列表框传递到父页面中gridview页脚行文本框中的文本框。在当前场景中,应用程序在按钮单击时中断。我尝试过使用Javascript,juery和C#,但所有结果都相同。有人对如何做到有什么建议吗?以下是我的代码:
我试图将值从列表框“lst_PdfViewers”传递到gridview文本框“AddSupplierName”上完成按钮单击事件“btnSupplierDone_Click”
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>
Popup 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();
}
}
答案 0 :(得分:0)
切换这些控件时,我得到了正确的结果。你有:
lst_PdfViewers.SelectedValue = txtAddSupplierName.Text;
但是如果你想在页脚行中lst_PdfViewers
的值使用:
txtAddSupplierName.Text = lst_PdfViewers.SelectedValue;