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

RadListBox and SelectedItems

1 Answer 127 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Sophie
Top achievements
Rank 1
Sophie asked on 28 Jun 2016, 09:58 AM

Hi,

I am using a RadListBox and I would like to find if the items that are selected in this list when clicking on a search button. However, when doing the following I have no item selected (the Label text is = 0) and I do not see why?

 

In my Search.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Search.ascx.cs" Inherits="Controls.Search.Search" %>

<telerik:RadListBox ID="List1" runat="server" SelectionMode="Multiple" CssClass="rListBx"/>

 

In my Search.ascx.cs:

Label.Text = List1.SelectedItems.Count().ToString();

My Search_Click function is in a partial class that inherits from System.Web.UI.UserControl 

 

In my Search.ascx.designer.cs

protected global::Telerik.Web.UI.RadListBox List1;

 

An idea about what I am doing wrong here?

Thanks

 

 

1 Answer, 1 is accepted

Sort by
0
Sophie
Top achievements
Rank 1
answered on 29 Jun 2016, 11:10 AM

To resolve the problem I replaced Page_Load by Page_Init...

 

Tags
ListBox
Asked by
Sophie
Top achievements
Rank 1
Answers by
Sophie
Top achievements
Rank 1
Share this question
or