Get SelectedIndex to Client-Side

2 posts, 0 answers
  1. Ayberk
    Ayberk avatar
    4 posts
    Member since:
    Jul 2010

    Posted 31 Mar 2011 Link to this post


    How i can get SelectedItemIndex in listview to client-side?


  2. Vasil
    Vasil avatar
    1604 posts

    Posted 06 Apr 2011 Link to this post

    Hello Ayberk,

    There is no client property that indicates which elements are selected in the ListView. But you can easily transfer the selected items from server-side to client-side using a hidden field for example.

    protected void RadListView1_PreRender(object sender, EventArgs e)
        string selectedIndexes = "";
        if (RadListView1.SelectedIndexes.Count > 0)
            selectedIndexes = RadListView1.SelectedIndexes[0].ToString();
        for (int i = 1; i < RadListView1.SelectedIndexes.Count; i++)
            selectedIndexes += ";" + RadListView1.SelectedIndexes[i];
        RadListView1SelectedIndexes.Value = selectedIndexes;
    var selectedIndexes = ($get("RadListView1SelectedIndexes").value).split(';') ;

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top