Examples with RadListBox - Telerik.Web.UI version 2015.1.225.35

1 Answer 114 Views
ListBox
Oscar Ivan
Top achievements
Rank 1
Oscar Ivan asked on 15 Nov 2022, 01:50 AM
Good day,

I am new to development with Telerik. You have a client where you have a website that has been developed with Telerik. The library used is Telerik.Web.UI version 2015.1.225.35

Explained this, I have 2 queries:
1. Telerik.Web.UI library version 2015.1.225.35 allows to use radlistbox to implement everything associated with listbox ? From what I have reviewed the documentation I understand that yes. If the answer is yes, then you can answer question 2.
2. Can you please give me examples of how to create a listbox using radlistbox since in my case what I want to do is create 2 listboxes and pass the elements from one listbox to another through a button.

I thank you in advance for the help provided.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Nov 2022, 09:56 AM

Hi Oscar,

The answer of 1 is yes, and you can use the All to the Right button to achieve your goal as shown in the Overview demo:

Please note that version 2015.1.225.35 is vulnerable to .NET JavaScriptSerializer Deserialization (CVE-2019-18935) and we strongly recommend upgrading to the latest one 2022.3.1109, which is free from known vulnerabilities and provides support for the latest browsers, WCAG 2.1 AAA accessibility, stability, and many new UI controls like the PdfViewer and useful features.

Best Regards,
Rumen
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Oscar Ivan
Top achievements
Rank 1
commented on 15 Nov 2022, 03:32 PM

Thank you very much.

 

 

Oscar Ivan
Top achievements
Rank 1
commented on 16 Nov 2022, 02:32 AM

Good day,

I took the Listbox Demo where DefaultCS.aspx and DefaultCS.aspx.cs appear, for which my pages that I have created are called wucPrioritizedSalesMaintainer.ascx and wucPriorizedSalesMaintainer.ascx.cs

In my code on the page wucPrioritizedSalesManager.ascx.cs
 a variable of type ListBox called LbAgents has been created where a list of names is going to be saved. quantity of the list of names that must be displayed are 5 and when clicking on GrupoListaNombres2 the quantity of the list of names that must be displayed is 10).

In the code of the DefaultCS.aspx page of the Demo I see that <telerik:RadListBoxItem Text="Argentina"></telerik:RadListBoxItem> is used to add the name of the countries.

In my case, how could I call my LbAgents variable (where I am saving the list of names) so that it is displayed on my page wucMantenedorVentasPriorizadas.ascx, in the telerik:RadListBoxItem do I have to use the Attributes property? If the answer is yes, you can help me by providing examples or documentation so that it can guide me to create the logic explained above.

Regards
Oscar
Rumen
Telerik team
commented on 16 Nov 2022, 09:15 AM

Hi Oscar, 

Check out this article which shows how to populate RadListBox on the server using its RadListBoxItemCollection collection - https://docs.telerik.com/devtools/aspnet-ajax/controls/listbox/radlistbox-items/working-at-server-side

Here you can also find out how to bind RadListBox to an array and ArrayList as in your scenario - Binding to Array or ArrayList.

Oscar Ivan
Top achievements
Rank 1
commented on 07 Dec 2022, 03:00 PM

Good day,

I want to get access to the controls of the Telerik RadGrid FormTemplate, can you explain how to do it?

Regards
Oscar

Oscar Ivan
Top achievements
Rank 1
commented on 07 Dec 2022, 07:50 PM

Good day,

When I try to use $find the term of the expression is not valid, I use Telerik.Web.UI 2015.1.225.35, in that version you can use the $find ?

Regards
Oscar
Rumen
Telerik team
commented on 07 Dec 2022, 11:08 PM

Please post your RadGrid-related question in the Grid forum. 

Meanwhile, you can check these resources:

Rumen
Telerik team
commented on 07 Dec 2022, 11:12 PM

$find is a MS AJAX (ASP.NET Web Forms) client-side method and it is not dependent on the Telerik version.

You can see how to get a reference to a Telerik control in this article: Getting Client-Side References to Control Objects.

On a side note version 2015.1.225.35 is vulnerable to critical issues and it is strongly recommended to upgrade to the latest version or at least 2020.1.114.

 

Oscar Ivan
Top achievements
Rank 1
commented on 09 Dec 2022, 07:22 AM

Good day,

When I use server-side techniques to interact with a control instance on the client-side, I have the following code:

ASP:NET
<telerik:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBoxDestination" Height="450px" Width="350px"
ButtonSettings-AreaWidth="35px" >
</telerik:RadListBox>

C#
string script = "function f(){$find(\"" + RadListBoxDestination.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);

The problem I am having in the C# code is that RadListBoxDestination mae appears the following error message "The name RadListBoxDestination does not exist in the Current Context".

Can you help me how to solve this problem.

Regards
Oscar
Valentin Dragnev
Telerik team
commented on 09 Dec 2022, 02:10 PM

Hello Oscar, 

Thank you for the screenshots! They clearly show that Visual Studio is unable to locate the Telerik controls.

Let me briefly mention a few steps to reassure that your project will have everything needed to locate the controls and build/run smoothly: 

  • Check for the Telerik.Web.UI.dll file inside the Bin folder of the project. If the assembly is missing re-add it.
  • Check for a missing reference to Telerik.Web.UI.dll in the Referencias node of Visual Studio Solution Exporer (Explorador de soluciones).
  • When you are working inside a Web User Control, it is recommended to use the UniqueID property. For more information see this blog post: The difference between ID, ClientID and UniqueID.
  • The show() method is part of the RadWindow API method and is not available for the RadListBox control. 
  • and keep in mind that script registration has to be done before the runnable part of the code. For example, you can define it at the Page_load.

For your convenience, I prepared and attached a runnable sample application, which you can use to compare with your project to find out what is missing and different.

Hope the provided information is helpful.

Regards

Oscar Ivan
Top achievements
Rank 1
commented on 16 Dec 2022, 04:56 PM

My control is inside code line 59 and 60 (Picture1.jpg). How do I reference it so that the data can be loaded dynamically since I put a log to see but no data appears in the RadListBox(Picture2.jpg)

Regards
Oscar
Valentin Dragnev
Telerik team
commented on 21 Dec 2022, 03:31 PM

Hello Oscar, 

From the provided screenshots it is not clear enough what is causing this error.

Most of the time, when you try to assign a value to an object, and if the value is null, then this "object reference not set to an instance of an object." exception occurs.

To check if the object is null you can set it inside a condition: 

if (myObj== null)
Console.Write("myObj is NULL");

Use a debugger and breakpoints inside the code behind to understand what is happening at every step of the execution of the code and see where the problem comes from:

Also please you can refer to those articles for more information and examples of how to bind data to the controls. 

 

Hope the provided information was helpful.

Oscar Ivan
Top achievements
Rank 1
commented on 21 Dec 2022, 05:34 PM

Hello

Sorry I wasn't clear about the problem I'm having, I have a RadListBox called RadListBoxDestination inside the controls <EditFormSettings EditFormType="Template">
             <FormTemplate>

What happens is that when I try to call RadListBoxDestination ma I get the following error message:
"Object reference not set to an instance of an object"

For me the problem is that my RadLisBox called RadListBoxDestination is inside the controls <EditFormSettings EditFormType="Template">
             <FormTemplate> and I'm not calling it correctly.

For this I have been doing 2 possible logics but I get the same error, these logics are:

Option 1

  logger.Info("RadListBoxDestination: " + RadListBoxDestination);
                 RadListBoxDestination.DataSource = AGAgents.Select(a => a.firstname + " " + a.lastname);
                 RadListBoxDestination.DataBind();

Option 2

if (e.Item is GridEditFormItem && e.Item.IsInEditMode)//editform
                 {
                     GridEditFormItem editItem = (GridEditFormItem)e.Item;
                     RadListBox RadListBoxDestination = (RadListBox)editItem.FindControl("RadListBoxDestination");
                     RadListBoxDestination.DataSource = AGAgents.Select(a => a.firstname + " " + a.lastname);
                     RadListBoxDestination.DataBind();
                 }

Can you help me how is that How do I reference it so that the data can be loaded dynamically since I put a log to see but no data appears in the RadListBox

Regards
Oscar
Attila Antal
Telerik team
commented on 26 Dec 2022, 09:29 AM

Hi Oscar,

Since your latest questions are moving away from the topic this thread was opened for, I advise you to submit a new Forum thread. Describe the issue you are experiencing, share the details/code of the implementation that fails (we need to see the complete code to be able to replicate the problem locally) and we will help debug it.

As the original question of this forum thread has been answered, I will close this thread now. For any new questions, please submit a new Forum thread.

Oscar Ivan
Top achievements
Rank 1
commented on 26 Dec 2022, 01:05 PM

Ok Thank you.
Tags
ListBox
Asked by
Oscar Ivan
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or