简体   繁体   中英

How to get the clicked LinkButton text in GridView to a label in Popup Panel

I am using a inside a GridView for a LinkButton.

what i need is to use the to appear on a on 出现在上的
在此输入图像描述

<asp:GridView ID="GridView1" runat="server"> 
    <Columns><asp:TemplateField>
    <ItemTemplate> 
    <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" Text='<%#Eval("empname") %>'></asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField></Columns> 
    </asp:GridView>

    <asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
    <asp:ModalPopupExtender ID="LinkButton1_ModalPopupExtender" runat="server" DynamicServicePath="" Enabled="True" TargetControlID="lnkDummy" PopupControlID="Panel1"> </asp:ModalPopupExtender> 
    <asp:Panel ID="Panel1" runat="server" Height="164px" Width="284px" BackColor="#CCCCFF" ><br /><br /> 
          <center><asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><br /><br /> 
          <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /><br />
          <asp:Button ID="Button1" runat="server" Text="Do"/></center>
    </asp:Panel>


code

        protected void LinkButton1_Click(object sender, EventArgs e)
    {
        LinkButton Lnk = (LinkButton)sender;
        Label2.Text = Lnk.Text;
        LinkButton1_ModalPopupExtender.Show();
    }
LinkButton btndetails = (LinkButton)e.CommandSource;

您现在可以访问您希望显示的btndetails文本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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