在网格视图中获取标签的值文本 [英] get value text of label in grid view
本文介绍了在网格视图中获取标签的值文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网格视图。
网格视图中的
有:
i have a grid view.
in grid view have :
<asp:Label ID="IdTopic" runat="server" Text='<%# Eval("IDTopic") %>' Visible="false"></asp:Label>
格外网格视图有:
out of grid view have :
<asp:Label ID="lb1" runat="server" ></asp:Label>
i希望从IdTopic获取文本并设置为lb1。
所有这些都进入了master的内容页面页面。
主页中的
我写这段代码:
i want get text from IdTopic and set on lb1.
all of them are into content page of master page.
in master page i writr this code:
function setLabel() {
var IdTopictxt = $("#IdTopic").val;
$("#lb1").text(IdTopictxt);
}
代码隐藏:c#
in code-behind:c#
ContentPlaceHolder cp = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder2");
Label lb = (Label)cp.FindControl("IdTopic");
if (lb != null)
{
ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowAlert();", true);
mytxt.Text = lb.Text.ToString();
}
我的提醒节目但不要在myTxt中显示任何内容。
我该怎么做?
my alert show but don,t show any in myTxt.
how i can do ?
推荐答案
( #IdTopic) .val;
( #lb1)。 (IdTopictxt);
}
("#lb1").text(IdTopictxt); }
代码隐藏:c#
in code-behind:c#
ContentPlaceHolder cp = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder2");
Label lb = (Label)cp.FindControl("IdTopic");
if (lb != null)
{
ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "ShowAlert();", true);
mytxt.Text = lb.Text.ToString();
}
我的提醒节目但不要在myTxt中显示任何内容。
我该怎么做?
my alert show but don,t show any in myTxt.
how i can do ?
检查此答案 -
在网格视图行中查找控件 [ ^ ]
这篇关于在网格视图中获取标签的值文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文