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

Posted by Kumartyr under ASP.NET on 10/30/2013 | Points: 10 | Views : 1098 | Status : [Member] | Replies : 5
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 the 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




Responses

Posted by: Kumartyr on: 11/18/2013 [Member] Starter | Points: 25

Up
0
Down

Resolved
in the linkbutton click event i did like below

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

i used that session value in another page like below

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

and got the result i want

Kumartyr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 10/30/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Dear Kumartyr,

Can you elaborate you question with some code.

Happy Coding.

Kumartyr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kumartyr on: 10/30/2013 [Member] Starter | Points: 25

Up
0
Down
thanks for ur reply i got the solution

Kumartyr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 10/30/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Share your solution here...
It will be helpful to others who have same problem

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kumartyr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 11/5/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Hi,

I think you can write on gridview ROWCOMMAND event like

suppose your gridview like below
<asp:Gridview id="gd" runat="server" OnRowCommand ="gd_RowCommand">
<coulmn>
<asp:templatefield>
<itemtemplate>
<asp:linkbutton id="lnl_view_details" COMMANDNAME="VIEW_DETAILS" CommandArguments = '<%# Eval("id") %>' runat="server"/>
</itemtemplate>
</templatefield>
</column>
</asp:gridview>
protected void gd_RowCommand(object sender, GridViewCommandEventArgs e)
{
//inside event write
if(e.CommandName.ToUpper.Equals("VIEW_DETAILS".ToUpper()))
{
int id = convert.toint32(e.CommandArgument.Tostring());
//do your activities with id
}
}

Kumartyr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response