List Box Item Click event?

4 posts, 0 answers
  1. Saima Gul
    Saima Gul avatar
    36 posts
    Member since:
    Mar 2010

    Posted 18 Mar 2010 Link to this post

    Hi
    My requirement is to get some values from database and show in a section (which can be hide by user)  when user click on item of list box whether it is already selected or not. List box has selected index change event which occurs when we change selection. So if List box has only one item then it can not fullfill my requirement. i need some item click like event so that functionally must occur whether item is already selected or not
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 22 Mar 2010 Link to this post

    Hello Saima Gul,

    Indeed you are right. RadListBox won't fire its SelectedIndexChanged event on subsequent clicks on the same item. The reason for this is that the selected index is not being changed at all. However, there is a workaround that you can use. I have prepared sample project demonstrating how to execute server click handler on every RadListBoxItem click. You can find the sample as an attachment.

    Sincerely yours,
    Genady Sergeev
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Saima Gul
    Saima Gul avatar
    36 posts
    Member since:
    Mar 2010

    Posted 27 Mar 2010 Link to this post

    Thanks for you response. It solves the problem that event occurs each time we click an item of list box but it did not return which item is selected and also does not select any item.
    My requirement is
    1. Select an item from list
    2. Find selected item in class and fetch data of selected item
    3. If user click on selected item again it should fetch data again
  5. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 31 Mar 2010 Link to this post

    Hello Saima Gul,

    In the click handler you can obtain the SelectedItem the following way:

    void hiddenSubmit_Click(object sender, EventArgs e)
     {
         var selectedItem = RadListBox1.SelectedItem;
         Response.Write(selectedItem.Text);
         //Use the selected item
     }

    On subsequent user click you can once again obtain the selected item using the SelectedItem property. I suppose that this will work with your requirements.

    Sincerely yours,
    Genady Sergeev
    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