如何获得在GridView中点击LinkButton的文本弹出面板中的一个标签 [英] How to get the clicked LinkButton text in GridView to a label in Popup Panel
本文介绍了如何获得在GridView中点击LinkButton的文本弹出面板中的一个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是模式弹出为一个LinkButton的GridView中。搜索结果
我需要的是用在点击LinkButton的以出现的标签 弹出面板的结果值
解决方案
< ASP:GridView控件ID =GridView1=服务器>
<柱体和GT;< ASP:的TemplateField>
<&ItemTemplate中GT;
< ASP:LinkButton的ID =LinkButton1=服务器的OnClick =LinkButton1_Click文本='<%#的eval(empname)%>'>< / ASP:LinkButton的>
< / ItemTemplate中>
< / ASP:的TemplateField>< /专栏>
< / ASP:GridView的> < ASP:LinkButton的ID =lnkDummy=服务器>< / ASP:LinkButton的>
< ASP:ModalPopupExtender ID =LinkButton1_ModalPopupExtender=服务器DynamicServicePath =启用=真的TargetControlID =lnkDummyPopupControlID =Panel1的> < / ASP:ModalPopupExtender>
< ASP:面板ID =Panel1的=服务器HEIGHT =164pxWIDTH =284px背景色=#CCCCFF>< BR />< BR />
<中心>< ASP:标签ID =Label2的=服务器文本=标签>< / ASP:标签>< BR />< BR />
< ASP:文本框ID =TextBox1的=服务器>< / ASP:文本框>< BR />< BR />
< ASP:按钮的ID =Button1的=服务器文本=做/>< /中心及GT;
< / ASP:面板>
结果
code
结果
保护无效LinkButton1_Click(对象发件人,EventArgs的发送)
{
LinkButton的LNK =(LinkButton的)寄件人;
Label2.Text = Lnk.Text;
LinkButton1_ModalPopupExtender.Show();
}
I am using a modal popup inside a GridView for a LinkButton.
what i need is to use the value of clicked LinkButton to appear on a label on Popup panel
解决方案
<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();
}
这篇关于如何获得在GridView中点击LinkButton的文本弹出面板中的一个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文