C# 如何在单击事件中将Linkbutton的文本转换为字符串类型
我正在gridview中发布问题。。。发布时,问题将从文本框文本转换为按钮单击事件中gridview中的linkbutton控件 到目前为止,我已经得到了我想要的,但是 我无法获取字符串类型的LinkButton文本,以便在其子页面顶部再次发布相同的问题,并在同一页面下单独查看其答复 做ASP.NETC2.0C# 如何在单击事件中将Linkbutton的文本转换为字符串类型,c#,asp.net,.net,gridview,linkbutton,C#,Asp.net,.net,Gridview,Linkbutton,我正在gridview中发布问题。。。发布时,问题将从文本框文本转换为按钮单击事件中gridview中的linkbutton控件 到目前为止,我已经得到了我想要的,但是 我无法获取字符串类型的LinkButton文本,以便在其子页面顶部再次发布相同的问题,并在同一页面下单独查看其答复 做ASP.NETC2.0 protected void QuestionLinkButton_Click(object sender, EventArgs e) { string LBQ = linkbut
protected void QuestionLinkButton_Click(object sender, EventArgs e)
{
string LBQ = linkbutton.text;
}
我使用了下面的代码,得到了我的结果
protected void QuestionLinkButton_Click(object sender, EventArgs e)
{
Session["LBQ"] = (sender as LinkButton).Text;
Response.Redirect("Thread.aspx");
}
及
您可以使用Damith的答案或字符串LBQ=发送者作为LinkButton.Text;
protected void QuestionLinkButton_Click(object sender, EventArgs e)
{
Session["LBQ"] = (sender as LinkButton).Text;
Response.Redirect("Thread.aspx");
}
protected void Page_Load(object sender, EventArgs e)
{
string Ques = Convert.ToString(Session["LBQ"]);
Questionlabel.Text = Ques;
}