Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using gridview for populating my data.

I have two text boxes in a page.
If I select a row in gridview, then values in select rows have to show in my text box.

How can I implement this concept?

Thanks in advance
Posted
Updated 24-Nov-11 23:46pm
v2
Comments
sriman.ch 25-Nov-11 4:53am    
How are you selecting the gridview row...?(either using a button or by any means)
sugumaran srinuvasan 25-Nov-11 4:59am    
i am selecting by select button
Dalek Dave 25-Nov-11 5:46am    
Edited for Grammar and Readability

hi try this:

in gridview property double click the event selectedIndexChanged,

 protected void grvItems_SelectedIndexChanged(object sender, EventArgs e)
{

 //sample 
 txtID.Text = grvItems.SelectedRow.Cells[1].Text;
}


hope it helps,

mark this as answer if it helps you

thanks!
 
Share this answer
 
Comments
sugumaran srinuvasan 25-Nov-11 5:09am    
i am using devexpress controls in project. it does not contain selectedrow.cell[] property. how to overcome that..
txtName.Text = GridView1.SelectedRow.Cells[0].Text

where 0 is the index of the selected row.
For ex.

Your table rows are Name, Age, Birthdate

0=Name, 1=Age, 2=Birthdate

Hope you get it!

Regards,
Eduard
 
Share this answer
 
Comments
sugumaran srinuvasan 25-Nov-11 5:09am    
i am using devexpress controls in project. it does not contain selectedrow.cell[] property. how to overcome that..
Similar question 2 hours ago

How to get the Values of Selected Row from a Gridview in TextBox[^]

EDIT


sugumar srinuvas wrote:
i am using devexpress controls in project. it does not contain selectedrow.cell[] property. how to overcome that..
But you didn't mention anything about that in your question, then how can we give you right solution, that's why we are telling the new members to post complete details(Code, description, error no & message, etc.,) in question. Anyway check this

Grid View - Row Selection[^]
 
Share this answer
 
v2
Comments
sugumaran srinuvasan 25-Nov-11 5:09am    
i am using devexpress controls in project. it does not contain selectedrow.cell[] property. how to overcome that..
sugumaran srinuvasan 25-Nov-11 5:33am    
thanks bro.....

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