弹出不在GridView控件的一个LinkBut​​ton点击募集 [英] Popup not raised in a linkbutton click of gridview

查看:123
本文介绍了弹出不在GridView控件的一个LinkBut​​ton点击募集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从显示网格视图弹出。但是,当我尝试在该网站运行低于code弹出的面板不可见。但是,当我删除面板的样式(即显示器=无;),那么它只是显示像一个小组,而不是像一个弹出。在链接按钮,网格视图中单击按钮,我想显示一个弹出。帮我...

I am trying to show a popup from a grid view. But when I try to run the below code in the website the popup panel is not visible. But when I remove the style for panel(i.e display=none;) then it just shows like a panel and not like a popup. In a button click of the link button in the grid view I am trying to show a popup. Help me...

<asp:UpdatePanel runat="server" ID="up1">
                        <ContentTemplate>
                            <asp:GridView ID="minidata" CssClass="table" runat="server" AutoGenerateColumns="false" DataKeyNames="abstract">

                                <Columns>
                                    <asp:BoundField DataField="pid" HeaderText="MyFileId" />
                                    <asp:BoundField DataField="video" HeaderText="MyFileurl" />
                                    <asp:TemplateField HeaderText="abstract">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkDownload" runat="server" Text="Download" OnClick="lnkDownload_Click"></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>

                            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>


                            <asp:Panel runat="server" ID="panel1" Height="200px" Width="300px" BorderStyle="Solid" BorderWidth="2px" style="display:none;">
                                <div>
                                    <table>
                                        <tr>
                                            <td>
                                                <asp:Label runat="server" Text="sacca"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="emails" runat="server"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:LinkButton runat="server">5e76d</asp:LinkButton>
                                            </td>
                                        </tr>
                                    </table>
                                </div>

                            </asp:Panel>
                            <asp:ModalPopupExtender ID="ModalPopupExtender1" PopupControlID="panel1" TargetControlID="Button1" runat="server"></asp:ModalPopupExtender>
                            <asp:Button ID="Button1" Style="display: none;" runat="server" Text="Button" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="minidata" />
                        </Triggers>
                    </asp:UpdatePanel>

在cs文件

    LinkButton lnkbtn = sender as LinkButton;
    GridViewRow gvrow = lnkbtn.NamingContainer as GridViewRow;
    string filePath = minidata.DataKeys[gvrow.RowIndex].Value.ToString();
    HiddenField1.Value = filePath;
    emails.Text = "myemail";
    this.ModalPopupExtender1.Show();

在这里输入的形象描述

而当我检查的网站,我不能发现在页面上显示的面板

And when I inspect the website I cannot found the panel displayed in the page

在这里输入的形象描述

推荐答案

是的,我之前就知道了。你必须来模拟你的modalPopupExtender的TargetControl点击。因此,在您code这似乎是Button1的。

Yeah I knew that before. You have to simulate the click on the TargetControl of your modalPopupExtender. So in your code it seems to be Button1.

因此​​,试图通过更换做到这

So try to do that by replacing this

<asp:LinkButton ID="lnkDownload" runat="server" Text="Download" OnClick="lnkDownload_Click"></asp:LinkButton>

<asp:LinkButton ID="lnkDownload" runat="server" Text="Download" onclick="$('[id$=Button1]').click()"></asp:LinkButton>

您的服务器端code是不是因为这个方法

Your server-side code is not useful for this method

好吧,你只是还没有JQuery的在您的应用程序^^。

Ok, you just haven't JQuery in your app ^^.

您可以加入JQuery的在您的应用程序,或者是一种约束?

Could you add JQuery in your app or it is a constraint ?

如果是这样,等待我发现你是土生土长的JavScript code,通过包括该尝试

If it is, waiting I found you a native JavScript code, try by including this

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"/>

这篇关于弹出不在GridView控件的一个LinkBut​​ton点击募集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆