简体   繁体   English

通过单击Gridview中的HyperLinkField来打开[ModalPopLite]弹出窗口

[英]Opening [ModalPopLite] Popup Window from clicking a HyperLinkField in a Gridview

I'm currently working on a website. 我目前正在网站上。 I want to open a pop-up when I click on a hyperlinkfield in the gridview table I have. 当我单击拥有的gridview表中的超链接字段时,我想打开一个弹出窗口。

<asp:GridView ID="EmployeeList" runat="server"/>

                    <Columns>
                        <asp:HyperLinkField
                            DataNavigateUrlFields="EmpID"
                            HeaderText="EMP ID"
                            Target="_blank"
                            DataNavigateUrlFormatString="google.com"
                            DataTextField="EmpID">
                        </asp:HyperLinkField>
                    </Columns>
</asp:GridView>

Here's my sample script: 这是我的示例脚本:

<script type="text/javascript">
    $(function () {
        $('#newuser_pop').modalPopLite({ openButton: '#clicker1'});
    });
</script>

Any help in this regard will be highly appreciated. 在这方面的任何帮助将不胜感激。 Thanks! 谢谢!

The problem in your case is that in asp.net controls are server side so in order to get id in jquery do as shown : 您遇到的问题是,在asp.net中,控件是服务器端的,因此为了在jquery中获取ID,请执行以下操作:

<script type="text/javascript">
  $(function () {
     $('#<%= newuser_pop.ClientID %>').modalPopLite({ openButton: '#clicker1'});
  });
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM