简体   繁体   English

如何将Linkbutton的文本转换为Click事件中的字符串类型

[英]how to get the Linkbutton's text to string type in it's Click event

i am posting the question in gridview ... while posting, question will get converted from textbox text to linkbutton control in the gridview in the button click event 我在网格视图中发布问题...在发布时,问题将在按钮单击事件中从文本框文本转换为网格视图中的linkbutton控件

upto this i have got what i want but 到目前为止,我有我想要的,但是

i am not able to fetch the LinkButton text in string type to post again same question on top of its child page and view it's replies alone under the same page 我无法获取字符串类型的LinkBut​​ton文本以在其子页面顶部再次发布相同的问题,并且无法在同一页面下单独查看其答复

doing ASP.net C# 2.0 做ASP.net C#2.0

protected void QuestionLinkButton_Click(object sender, EventArgs e)
    {
string LBQ = linkbutton.text; 
}
protected void QuestionLinkButton_Click(object sender, EventArgs e)
{
    LinkButton btn = sender as LinkButton;
    string LBQ = btn.Text; 
}

i used below code and got my result 我使用下面的代码,并得到了我的结果

protected void QuestionLinkButton_Click(object sender, EventArgs e)
    {
        Session["LBQ"] = (sender as LinkButton).Text;
        Response.Redirect("Thread.aspx");
    }

and

protected void Page_Load(object sender, EventArgs e)
    {
 string Ques = Convert.ToString(Session["LBQ"]);
        Questionlabel.Text = Ques;      
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用c#asp.net在LinkBut​​ton的click事件中获取gridview的DataKeyNames值 - How to get DataKeyNames value of gridview inside LinkButton's click event using c# asp.net 如何在RowCommand事件中获取GridView的LinkBut​​ton前景色? - How to get GridView's LinkButton ForeColor in RowCommand Event? 在链接按钮单击时,不会触发Repeater的Item命令事件 - Repeater's Item command event is not firing on linkbutton click 如何通过单击另一页面的链接按钮来调用按钮的单击事件,而无需在c#ASP.NET中回发 - How to call button's click event from click of linkbutton of another page without post back in c# ASP.NET 如何获取使用文字创建的asp linkbutton的click事件? - how to get click event of asp linkbutton which is created using literal? 如何在LinkBut​​ton Click事件的GridView中获取单元格值? 还是RowCommand? - How to get cell value in a GridView on LinkButton Click Event? Or RowCommand? 在更新面板中捕获UserControl的Linkbutton事件 - Capture UserControl's Linkbutton event in inside an updatepanel 将LinkBut​​ton的OnClick事件设置为代码隐藏中的方法 - Setting LinkButton's OnClick event to method in codebehind 如何取消linkBut​​ton_Click()事件 - How to cancel linkButton_Click() Event 如何在LinkBut​​ton点击事件上启动电子邮件客户端? - How to launching email client on LinkButton click event?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM