Click here to Skip to main content
15,898,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
By Using Grid View We Can Pick a row from Grid View and Show its data in TextBox using the following way.

txtDishName.Text = ((Label)(grdDishDetails.SelectedRow.FindControl("lblDishName"))).Text;

But how can we pick a row from ListView and Show its Data in the Text Box???

please tell me.....
Posted

1 solution

The solution is you can get it in the selection changed event of the ListView control.. Sender object is actually the current selected ListView you could get the row as object like below

C#
var res = (sender as ListView).SelectedItem;



You may have to cast the selectedItem to your current object whatever you have used to fill the list view

C#
var res = (classname)(sender as ListView).SelectedItem;
 
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