This is a migrated thread and some comments may be shown as answers.

how get SelectedItem Fileds such as key(ID) , Name , ... in ItemCommand event ?

5 Answers 256 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Majid Darab
Top achievements
Rank 1
Majid Darab asked on 18 May 2011, 04:33 PM
hi my dear friends :
how can i get SelectedItem Fileds such as key(ID) , Name , ... in ItemCommand event ?

(asp.net with c# - vs 2010)
thanks for attentions

5 Answers, 1 is accepted

Sort by
0
Gimmik
Top achievements
Rank 1
answered on 18 May 2011, 05:07 PM
Hello my friend,

I think this is what you're looking for:
http://www.telerik.com/help/aspnet-ajax/grid-retrieve-primary-key-field-values-for-items.html

Hope that helps!
-Gimmik
0
Majid Darab
Top achievements
Rank 1
answered on 18 May 2011, 05:32 PM
thanks for answer ...
i also had found your link - but i do n't know how can i use it in LISTVIEW ?
would be appreciate for help About ListView...
0
Accepted
Gimmik
Top achievements
Rank 1
answered on 18 May 2011, 05:43 PM
ah - you didn't mention you were working with a listview. In that case, this link provided four excellent examples for extracting values from the selected entry of a listview. Let me know if you have any questions.

http://www.telerik.com/help/aspnet-ajax/listview-selecting-items.html

-Gimmik
0
Majid Darab
Top achievements
Rank 1
answered on 18 May 2011, 05:58 PM
really thanks again ...

the below codes are ok
RadListViewDataItem item = e.ListViewItem as RadListViewDataItem;
hfSelectedID.Value = item.GetDataKeyValue("ID").ToString();

but i have some problem for getting Name Field with below codes :
(i know we can get it by id - but i want to learn how can we get it by ListView Codes)
RadListViewDataItem item = e.ListViewItem as RadListViewDataItem;
string myValue = DataBinder.Eval(item.DataItem, "Name").ToString();

thanks for attention
0
Marie
Top achievements
Rank 1
answered on 20 Nov 2014, 04:23 PM
Yes...
Thanks!!!!
Tags
ListView
Asked by
Majid Darab
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
Majid Darab
Top achievements
Rank 1
Marie
Top achievements
Rank 1
Share this question
or