Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
please can u provide the information how to retrieve the data from gridview in textbox
Posted

Try the code below:

C#
textbox1.text = GridView1.Rows[0].Cells[0].Text.ToString();
 
Share this answer
 
v2
Comments
yogiCsharp 29-May-11 23:58pm    
in C# the syntax should be
textbox1.text = GridView1.Rows[0].Cells[0].Text.ToString();
Wild-Programmer 30-May-11 0:02am    
oh yes, forgot to convert it from VB ;)
If you are talking about ASP.net web application, the solution could be this :

String text = ((TextBox)GridView1.Rows(0).Cells(0).FindControl("textboxID")).Text;

you just have to provide the ID of your TextBox Control that you have put in the grid
 
Share this answer
 
v2
Comments
RaviRanjanKr 30-May-11 0:16am    
Minor Editing :- Wrapped your Code in Code Block. :)
First of you have to write the code to fill a grid view then you have to write code
textbox1.text=dataGridView1.SelectedRows[0].Cells[0].Value.ToString();

the above code you can write on button click or gridview selection change event

Solution By:
Kabir
EmailIDRemoved@gmail.com
 
Share this answer
 
v2
Comments
RaviRanjanKr 30-May-11 0:18am    
Never wrapped normal sentences in "Pre" tag and Please don't mention EmailID in question as well as in Answer. its against of CodeProject rule :)

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