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

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

doing 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归因
不隶属于 StackOverflow
scroll top