Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi this is anil here , i want to pass value of griedview of selected row of button to another text box of another page , please help me , i search a lot but i am getting result using hyperlink button not with the button .
Posted

1 solution

Anil LinkButton and Button in this factor has only one difference which is the type, one is LinkButton and one is Button. So what ever code you are writing in LinkButton write the same code in Button, just change if there is any LinkButton typecasting to Button.

And now the main issue,to send value of the selected row's text box value. If you can get it then you can also send it to another textbox. So use RowCommand event of GridView and within that catch the button click with CommandName/CommandValue of Button or LinkButton. And then with the help of FindControl function get the value of either TextBox or Label or any other controls. Take a look on the code bellow.
string Ques = ((TextBox)GridViewFRM.Rows[i].FindControl("GVQuestionTextBox")).Text; 

C#
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
   {
        if (e.CommandName == "More")
        {
            string Ques = ((TextBox)GridViewFRM.Rows[i].FindControl("GVQuestionTextBox")).Text; 
        }
    }  
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900