Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi everyone,
Guys which event should be used to pass value from GridView to textbox.
Let me explain, i have a form like this,
have got 4 textboxes viz., state, district, City and pincode after entering details a save button which saves all the above mentioned to a grid. If a user wants to edit he/she will click a any row in a grid which in turn should display state, district, City and pincode respectively in the text boxes and this is my problem.
How to display value/text from gridview to text box

Can anyone help me..,i'm stuck. Thanks in advance
Posted
Updated 2-Aug-12 7:24am
v3
Comments
Sergey Alexandrovich Kryukov 2-Aug-12 13:21pm    
What grid view type, exactly? Forms? ASP.NET? any other?
And also, would you display the purpose of it? If a user selects a row, the data in the selection is already quite visible, why confuse the user by duplicating it?
--SA

you have 3 ways to show.

1. use selectedindexchanged event, in which you can get the values of a selected index (row values) and pass it to textboxes

2. Use Editindex event , with which you can directly chnage the values by placing textboxes inside the gridview

3. use row command event
 
Share this answer
 
Comments
Manjunatha Shankar 3-Aug-12 2:29am    
Hi santosh pabba,
thanks for your valuable reply. Thing is i have done same with windows application but in web application this was the first time and i got what i was searching for. Thanks again santosh and thanks to code project:)
its simple to use gridview editing with text boxes in edit item templates..
you can simply bind data to textboxes in edit item templates..

by selecting edit data bindings of text box
choose custom binding
in code expression add
Eval("dataset field")
 
Share this answer
 
Comments
Manjunatha Shankar 3-Aug-12 2:39am    
Hi jinu kannur,
Yeah ur right, we can use command field-edit,update,cancel to edit gridview. But our requirement was click on any gridview row and same gridview values reflected on text boxes and at this point i got stuck:(

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