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

6 posts, 1 answers
  1. Majid Darab
    Majid Darab avatar
    110 posts
    Member since:
    Sep 2012

    Posted 18 May 2011 Link to this post

    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
  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 18 May 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Majid Darab
    Majid Darab avatar
    110 posts
    Member since:
    Sep 2012

    Posted 18 May 2011 Link to this post

    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...
  5. Answer
    Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 18 May 2011 Link to this post

    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
  6. Majid Darab
    Majid Darab avatar
    110 posts
    Member since:
    Sep 2012

    Posted 18 May 2011 Link to this post

    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
  7. Marie
    Marie avatar
    9 posts
    Member since:
    May 2014

    Posted 20 Nov 2014 in reply to Gimmik Link to this post

    Yes...
    Thanks!!!!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017