我有一个网格视图和一个内部有文本框的列。我希望当我点击文本框时出现一个模态弹出窗口,让我介绍一些数据。
我不知道如何点击这个活动。
<asp:GridView ID="GridViewSW" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSourceShippingWarehouse">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" />
<asp:TemplateField HeaderText="Audit">
<ItemTemplate>
<asp:TextBox ID="txtSWAudit" runat="server" Height="16px" Width="76px" OnClick="txtSWAudit_Click" AutoPostBack="true"></asp:TextBox>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtenderSWAudit"
runat="server"
WatermarkText="Click to add "
TargetControlID="txtSWAudit" />
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
<asp:Button ID="btnAddAudit" runat="server" style="display: none" />
<asp:Panel ID="pnlAddAudit" runat="server">
<asp:Label ID="lblNrForm" runat="server" Text="Number Form"></asp:Label>
<asp:TextBox ID="txtNrForm" runat="server"></asp:TextBox>
<cc1:TextBoxWatermarkExtender ID="TBWEAudit"
runat="server"
WatermarkText="Write a number"
TargetControlID="txtNrForm" />
<asp:Button ID="btnSave" runat="server" Text="Save" />
<asp:Button ID="btnCloseAudit" runat="server" Text="Close" />
</asp:Panel>
<cc1:ModalPopupExtender ID="MPEAudit"
runat="server"
TargetControlID="btnAddAudit"
DropShadow="True"
PopupControlID="pnlAddAudit"
OkControlID="btnSave"
CancelControlID="btnCloseAudit">
</cc1:ModalPopupExtender>
答案 0 :(得分:1)
首先,您需要通过在gridview中搜索并找到一个事件来找到文本框,如下所示:
$('#<%= GridViewSW.FindControl("txtSWAudit").ClientID%>').on('click',function(e){
$find('MPEAudit').show();});
有关ASP.NET AJAX Control Toolkit ModalPopupExtender的更多信息,请查看此codeproject