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

RadCombobox programmatically

5 Answers 232 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Franz Wunderlich
Top achievements
Rank 1
Franz Wunderlich asked on 30 Jun 2008, 02:28 PM

I want to create a ListUtility class for RadCombobox.
This class should be like a DropDownlist.
Example:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
/// <summary>
/// Utility Klasse. Hilfsfunktionen für Dropdown Listen
/// </summary>
public static class ListUtility {
 public static void FillDropDownList( DropDownList list, ArrayList sl, bool addEmpty ) {
  try {
   if (addEmpty && (1 != sl.Count)) {
    list.Items.Add( "" );
   }
   foreach (WListItem entry in sl) {
    ListItem item = new ListItem( entry.Value, entry.Key );
    list.Items.Add( item );
   }
  } catch (Exception ex) {
   LogUtil.LogMessage( "Fatal Error in FillDropDownList\r\n" + ex.Message + "\r\n" + ex.StackTrace );
  }
 }
 public static void FillDropDownList( DropDownList list, IDictionary sl ) {
  FillDropDownList( list, sl, true );
 }
 public static void FillDropDownList( DropDownList list, ArrayList sl ) {
  FillDropDownList( list, sl, true );
 }
}

In the example above, the namespace is System.Web.UI.WebControls.
How combine programmatically a RadComboBox?

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 Jul 2008, 06:09 AM
Hello Franz Wunderlich,

You can check this help topic which explains how to add RadComboBoxItems programmatically.

Kind regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Franz Wunderlich
Top achievements
Rank 1
answered on 01 Jul 2008, 11:59 AM

I have meant,

the type RadComboBox as parameter in a static methode, like a Dropdownlist

Example with Dropdownlist

public static void FillDropDownList( DropDownList list, ArrayList sl );


Example with RadComboBox

public static void FillComboBoxList(  ??RadComboBoxType?? list, ArrayList sl );

Is that allright and when yes, what is the name of this type and what is the namespace?

0
Atanas Korchev
Telerik team
answered on 01 Jul 2008, 12:04 PM
Hello Franz Wunderlich,

The type of RadComboBox is Telerik.Web.UI.RadComboBox.

I hope this helps,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Franz Wunderlich
Top achievements
Rank 1
answered on 02 Jul 2008, 08:49 AM

I have for our project the following folder composition

Solution Hansalog.Travel
   D:\prjWorkingFolderWunderlich\Hansalog.Trave.WebUI\
      - Bin
          ...
        + Telerik.Web.UI.dll
             Telerik.Web.UI.dll.refresh
          Telerik.Web.UI.xml
      ...
      Beleg_neu.aspx
         Beleg_neu.aspx.cs
      ...
   D:\prjWorkingFolderWunderlich\WebApproval
   Dokumentation
   Hansalog.Travel.Bois
   Hansalog.Travel.ConfigUI
   Hansalog.Travel.Controls
   Hansalog.Travel.Dal
   Hansalog.Travel.Framework
      + Properties
      + References
      + DataImport
        Membership
        ...
        ListUtility.cs
        ...
        web.config
   TestConnect

In the File

web.config 

is the following line:

<add tagPrefix="telerik" 
     namespace="Telerik.Web.UI"
     assembly="Telerik.Web.UI" />

In the Page_Load event of Beleg_neu.aspx.cs
is actually following method

ListUtility.FillDropDownList( lstKostenart, ... )

In the Helperclass static ListUtility is the
static method fillDropDownList(...) with the
parameters

"DropDownList list, ArrayList sl"

.
This method load the items in the Dropdown-
Control.

I want to do the same functionality with
new static method

FillComboBox(...) 

in the
class ListUtility, where the Parameters
are

RadComboBox

 and

ArrayList

.

To include the type Telerik.Web.UI, i have
use the following using statement:

using Telerik.Web.UI;

Then the FillComboBox has the parameters

"RadComboBox Combo, ArrayList sl"

 
unfortunately comes the error message:
The type or namespace name 'Telerik' could
not be found (are you missing a using
directive or an assembly reference).

Now i have try to add a assembly reference,
but under the tab .NET I don't found
an corresponding item, only the item
Telerik.Charting.

I have the RadControls normally installed
with the execute File:
RadControls_for_ASP.NET_AJAX_2008_1_619_dev.exe

Our development system is Visual Studio 2005

what is yet wrong?

0
Atanas Korchev
Telerik team
answered on 02 Jul 2008, 08:53 AM
Hi Franz Wunderlich,

The Telerik.Web.UI.dll assembly is not added in GAC hence you don't see it in the .NET assemblies tab. You can however find it the location where you installed RadControls for ASP.NET ajax inside the bin folder.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Franz Wunderlich
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Franz Wunderlich
Top achievements
Rank 1
Share this question
or