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

ComboBox Problem

3 Answers 90 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
support
Top achievements
Rank 1
support asked on 23 Nov 2010, 07:46 AM
Hi Telerik Team,

I have ComboBox as below which does not get displayed properly after postback. Please refer to attached image (Combobox for 'Existing Documents' ).
 <telerik:RadComboBox ID="rcmbExisting" runat="server" AutoPostBack="true" CausesValidation="false" EmptyMessage="Select Existing"  Width="300px" Height="250px" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" ItemsPerRequest="250" OnItemsRequested="rcmbExisting_ItemsRequested" />

Please suggest solution.

Thanks in advance. 

 

With Regards,
Reena 

 

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 24 Nov 2010, 10:32 AM
Hi Reena,

RadComboBox doesn't load its skin for some reason. We cannot help unless you send us a live url or a simple page which reproduces the issue. Thanks in advance

All the best,
Yana
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
support
Top achievements
Rank 1
answered on 25 Nov 2010, 02:06 AM
Imports intranet.BLL
Imports System.IO
Imports GlobalClass
Imports System.Data
Imports System.Data.SqlClient
  
Partial Class Controls_LeftMenu_LeftMenuFormView
    Inherits System.Web.UI.UserControl
  
    Private mWidth As Integer = 500
    Public Event doneClicked(ByVal sender As Object, ByVal e As System.EventArgs) 'N    
    Private UserCredentials As User
    Private Const ItemsPerRequest As Integer = 250
    'Private attachClicked As Boolean = False
    Private DisplayMessageBox As String = "LeftMenuFormBox"
  
    Public Sub onDoneClicked(ByVal del As doneClickedEventHandler)
        AddHandler doneClicked, del
    End Sub
  
#Region "Properties"
  
    Public Property Mode() As enumMode
        Get
            Return ViewState(GlobalClass.ModuleMode)
        End Get
        Set(ByVal value As enumMode)
            ViewState(GlobalClass.ModuleMode) = value
            InitialisePanelTitle()
        End Set
    End Property
  
    Public Property MenuItemID() As Integer
        Get
            Return ViewState(GlobalClass.MenuItemID)
        End Get
        Set(ByVal value As Integer)
            ViewState(GlobalClass.MenuItemID) = value
            InitialiseItem()
        End Set
    End Property
  
    Public Property MenuItemParentID() As Integer
        Get
            Return ViewState(GlobalClass.MenuItemParentID)
        End Get
        Set(ByVal value As Integer)
            ViewState(GlobalClass.MenuItemParentID) = value
        End Set
    End Property
  
#End Region
  
#Region "Page Methods"
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            UserCredentials = setSecurity()
            InitialiseUIPanel()
            'Fix for FileUpload within UpdatePanel
            Page.Form.Attributes.Add("enctype", "multipart/form-data")
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Private Sub InitialiseItem()
        Try
            Dim oMenuItem As New menuLeftItem(MenuItemID) 'Get Menu Item object     
            Dim ItemType As enumItemType = oMenuItem.ItemType
  
            UserCredentials = setSecurity()
  
            PopulateRadioButtonTypeList()
            rblMenuItemType.SelectedValue = ItemType
            PrepareForm(ItemType)
            rblMenuItemType.Enabled = False
            btnDone.Enabled = True
  
            If Not oMenuItem.ShortcutID = Nothing Then
                ddlMenuShortcut.SelectedValue = oMenuItem.ShortcutID
                ddlSubsite.SelectedValue = oMenuItem.SiteID
                PopulateMenuShortcutDDL(oMenuItem.SiteID)
            End If
  
            If ItemType = enumItemType.Document Then rfvLink.Enabled = False
  
            txtMenuItemName.Text = oMenuItem.Label
            txtDescription.Text = oMenuItem.Description
            txtLink.Text = oMenuItem.Link
  
            dpExpiryDate.Text = Format(Date.Parse(oMenuItem.ExpiryDate), "MMMM d, yyyy")
            cboxIsActive.Checked = oMenuItem.Status
  
            Dim ItemID As Integer
            If Not oMenuItem.ResourceID = Nothing Then
                hfOriginalPath.Value = oMenuItem.Link
                ddlLink.SelectedValue = oMenuItem.ResourceID
                ItemID = oMenuItem.ResourceID
            Else : ItemID = oMenuItem.MenuItemID
            End If
  
            Dim objType As String
            If ItemType = enumItemType.Folder Or ItemType = enumItemType.Menu Then
                objType = "M"
            Else : objType = "R"
            End If
  
            fillCurrentSecurityGroupMembership(ItemID, objType)
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Private Sub InitialisePanelTitle()
        If Mode = enumMode.Create Then
            ucPanelHeader.PanelTitle = "Add a Menu Item"
        Else : ucPanelHeader.PanelTitle = "Edit Menu Item"
        End If
    End Sub
  
    Private Sub InitialiseUIPanel()
        Try
            ' IF THE COOKIES HAVE BEEN SET BY THE JAVASCRIPT, THEN USE THE VALUES HERE
            If Request.Cookies("editwin_left") IsNot Nothing Then
                If Not String.IsNullOrEmpty(Request.Cookies("editwin_left").Value.ToString) Then
                    panelLeftMenuEditorPanel.Style.Add("left", Request.Cookies("editwin_left").Value.ToString)
                    panelLeftMenuEditorPanel.Style.Add("top", Request.Cookies("editwin_top").Value.ToString)
                Else
                    panelLeftMenuEditorPanel.Style.Add("left", "400px")
                    panelLeftMenuEditorPanel.Style.Add("top", "320px")
                End If
            Else
                panelLeftMenuEditorPanel.Style.Add("left", "400px")
                panelLeftMenuEditorPanel.Style.Add("top", "320px")
            End If
  
            'Header Panel
            ucPanelHeader.onCloseHeaderClick(AddressOf CloseLeftMenuEditor)
            ucPanelHeader.Link_close = True
            ucPanelHeader.PanelWidth = (mWidth - 5).ToString
  
            'Content Panel
            panelLeftMenuEditorPanel.Width = mWidth
            panelContent.Width = (mWidth - 2).ToString
  
            ' DRAGGABLE EDIT WINDOW
            panelLeftMenuEditorPanel.Attributes.Add("intranetname", "panelLeftMenuEditorPanel")
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Private Sub PrepareForm(ByVal itemType As enumItemType)
        Try
            ClearForm()
            pnlMenuItemName.Visible = True
            pnlSecurity.Visible = True
  
            Select Case itemType
                Case enumItemType.Folder
                    rfvLink.Enabled = False
  
                Case enumItemType.Menu
                    pnlMenuShortcut.Visible = True
                    PopulateSubsiteDDL()
                    rfvLink.Enabled = False
  
                Case enumItemType.Document
                    pnlResource.Visible = True
                    lblLink.Text = "File Name"
                    lblLink.Visible = True
                    fuResource.Visible = True
                    btnAttach.Visible = True
                    rfvMenuShortcut.Enabled = False
                    rfvLink.ErrorMessage = "File Required"
                    rfvLink.ControlToValidate = fuResource.ID
                    pnlExisting.Visible = True
                    lblExisting.Text = "Existing Documents"
  
                Case enumItemType.Forms
                    pnlResource.Visible = True
                    lblLink.Text = "File Name"
                    lblLink.Visible = True
                    fuResource.Visible = True
                    btnAttach.Visible = True
                    rfvMenuShortcut.Enabled = False
                    rfvLink.ErrorMessage = "File Required"
                    rfvLink.ControlToValidate = fuResource.ID
                    pnlExisting.Visible = True
                    lblExisting.Text = "Existing Forms"
  
                Case enumItemType.ASPX
                    ddlLink.Visible = True
                    lblLink.Visible = True
                    rfvMenuShortcut.Enabled = False
                    rfvLink.ControlToValidate = ddlLink.ID
                    'PopulateResourceLinkDDL(enumItemType.ASPX)
  
                Case enumItemType.ExternalURL
                    pnlResource.Visible = True
                    lblLink.Visible = True
                    txtLink.Visible = True
                    rfvMenuShortcut.Enabled = False
                    rfvLink.ControlToValidate = txtLink.ID
            End Select
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
#End Region
  
#Region "Events"
  
    Protected Sub rblMenuItemType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rblMenuItemType.SelectedIndexChanged
        Try
            PrepareForm(rblMenuItemType.SelectedValue)
            fillInheritedSecurityGroupMembership()
            btnDone.Enabled = True
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Protected Sub ddlSubsite_SelectedIndexChanged(ByVal o As System.Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles ddlSubsite.SelectedIndexChanged
        Try
            If ddlSubsite.SelectedValue = Nothing Then
                ddlMenuShortcut.Text = String.Empty
                ddlMenuShortcut.Items.Clear()
            Else : PopulateMenuShortcutDDL(ddlSubsite.SelectedValue)
            End If
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Protected Sub rcmbExisting_SelectedIndexChanged(ByVal o As System.Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcmbExisting.SelectedIndexChanged
        Try
            If rcmbExisting.SelectedValue = Nothing Then
                PrepareForm(enumItemType.Document)
            Else
                fuResource.Visible = False
                btnAttach.Visible = False
                lblLink.Visible = False
                rfvLink.Enabled = False
                PopulateDocumentDetails(rcmbExisting.SelectedValue)
            End If
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Protected Sub btnDone_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDone.Click
        Try
            If Page.IsValid Then 'Check if required fields have been entered
                If Mode = enumMode.Create Then
                    If rblMenuItemType.SelectedValue = enumItemType.Folder Then
                        CreateFolder()
                    ElseIf rblMenuItemType.SelectedValue = enumItemType.Document Or rblMenuItemType.SelectedValue = enumItemType.ExternalURL Or rblMenuItemType.SelectedValue = enumItemType.Forms Then
                        If rcmbExisting.Text.ToString().Equals(String.Empty) Then
                            CreateDocumentExternalUrl(False)
                        Else
                            CreateDocumentExternalUrl(True)
                        End If
                        Else : CreateMenuShortcutOrASPX()
                        End If
                Else : Mode = enumMode.Update
                    If rblMenuItemType.SelectedValue = enumItemType.Folder Then
                        UpdateFolder()
                    ElseIf rblMenuItemType.SelectedValue = enumItemType.Document Or rblMenuItemType.SelectedValue = enumItemType.ExternalURL Or rblMenuItemType.SelectedValue = enumItemType.Forms Then
                        UpdateDocumentOrExternalUrl()
                    Else : UpdateMenuShortcutOrASPX()
                    End If
                End If
                CloseForm()
                RaiseEvent doneClicked(sender, e) 'Refresh Left Menu            
            End If
        Catch ex As IntranetException
            DisplayUIMessage(Me.Page, DisplayMessageBox, "Warning", ex.Message)
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Try
            PopulateRadioButtonTypeList()
            CloseForm()
        Catch ex As IntranetException
            DisplayUIMessage(Me.Page, DisplayMessageBox, "Warning", ex.Message)
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Private Sub CloseLeftMenuEditor(ByVal sender As Object, ByVal e As System.EventArgs)
        Try
            CloseForm()
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
    Protected Sub btnAttach_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAttach.Click
        Try
            If fuResource.HasFile Then
                hfOriginalPath.Value = UploadFile("Resource")
                lblFileUploaded.Text = fuResource.FileName.ToString & " uploaded successfully ."
                lblFileUploaded.Visible = True
                rfvLink.Enabled = False
            End If
        Catch ex As IntranetException
            DisplayUIMessage(Me.Page, DisplayMessageBox, "Warning", ex.Message)
        Catch ex As Exception
            LogAndDisplayError(ex, Me.Page, DisplayMessageBox, "Exception", System.Reflection.MethodInfo.GetCurrentMethod())
        End Try
    End Sub
  
#End Region

#Region "General Methods"
  
    Public Sub PopulateRadioButtonTypeList()
        Try
            rblMenuItemType.Items.Clear()
            rblMenuItemType.DataSource = New GlobalParameterList(enumGlobalParameterType.MenuItemType)
            rblMenuItemType.DataTextField = "GlobalParameterKey"
            rblMenuItemType.DataValueField = "GlobalParameterValue"
            rblMenuItemType.DataBind()
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
    Private Sub PopulateSubsiteDDL()
        Try
            ddlSubsite.DataSource = New Sites
            ddlSubsite.DataTextField = "Name"
            ddlSubsite.DataValueField = "SiteID"
            ddlSubsite.DataBind()
            ddlSubsite.Items.Insert(0, New Telerik.Web.UI.RadComboBoxItem(""))
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
    Private Sub PopulateMenuShortcutDDL(ByVal _subsiteID As Integer)
        Try
            Dim subsite As New Site(_subsiteID)
            Dim oMenuLeftItems As New menuLeftItems(subsite.MenuItemID, UserCredentials.UserID)
  
            ddlMenuShortcut.DataSource = oMenuLeftItems
            ddlMenuShortcut.DataTextField = "Label"
            ddlMenuShortcut.DataValueField = "MenuItemID"
            ddlMenuShortcut.DataBind()
            ddlMenuShortcut.Items.Insert(0, New Telerik.Web.UI.RadComboBoxItem(""))
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
    Protected Sub PopulateDocumentDetails(ByVal _ResourceID As Integer)
        Try
            Dim oResource As New Resource(_ResourceID)
            txtMenuItemName.Text = oResource.Title.ToString
            txtDescription.Text = oResource.Description.ToString
            txtDescription.Enabled = False
            dpExpiryDate.Text = oResource.ExpiryDate.ToString()
            dpExpiryDate.Enabled = False
            dpExpiryDate.CssClass = ""
  
            btnEditRightArrow.Enabled = False
            btnEditLeftArrow.Enabled = False
            btnReadLeftArrow.Enabled = False
            btnReadRightArrow.Enabled = False
            cboxIsActive.Enabled = False
  
            hfOriginalPath.Value = oResource.Link.ToString
  
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
    Protected Sub PopulateResourceLinkDDL(ByVal _itemType As enumItemType)
        Try
            Dim oResources As New Resources
            oResources.getAllActiveResources(UserCredentials.UserID, _itemType)
  
            ddlLink.DataSource = oResources
            ddlLink.DataTextField = "Title"
            ddlLink.DataValueField = "ResourceID"
            ddlLink.DataBind()
            ddlLink.Items.Insert(0, New Telerik.Web.UI.RadComboBoxItem(""))
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
    Protected Sub PopulateRadcmbExisting(ByVal _itemType As enumItemType)
        Try
            Dim oResources As New Resources
  
            oResources.getAllActiveResources(UserCredentials.UserID, _itemType)
  
            rcmbExisting.DataSource = oResources
            rcmbExisting.DataTextField = "Title"
            rcmbExisting.DataValueField = "ResourceID"
            rcmbExisting.DataBind()
            rcmbExisting.Items.Insert(0, New Telerik.Web.UI.RadComboBoxItem(""))
        Catch ex As Exception
            Throw New Exception(ex.Message)
        End Try
    End Sub
  
    Public Sub ClearForm()
        btnDone.Enabled = False 'Disable Save till an Item Type has been selected
        rblMenuItemType.Enabled = True
        cboxIsActive.Checked = True
        dpExpiryDate.Text = Format(Date.Parse(DateAdd(DateInterval.Year, 1, Now)), "dddd, d MMMM, yyyy")
  
        txtMenuItemName.Text = String.Empty
        txtDescription.Enabled = True
        txtDescription.Text = String.Empty
        txtLink.Text = String.Empty
        rfvLink.ErrorMessage = "Link Required"
  
        lblLink.Text = "Link"
        lblLink.Visible = False
        ddlLink.Visible = False
        txtLink.Visible = False
        fuResource.Visible = False
        lblFileUploaded.Visible = False
        btnAttach.Visible = False
  
        ddlMenuShortcut.Text = String.Empty
        ddlMenuShortcut.Items.Clear()
  
        pnlMenuItemName.Visible = False
        pnlMenuShortcut.Visible = False
        pnlResource.Visible = False
        pnlSecurity.Visible = False
        pnlExisting.Visible = False
        rcmbExisting.Text = String.Empty
        ddlLink.Text = String.Empty
  
        txtMenuItemName.ReadOnly = False
        txtDescription.ReadOnly = False
        dpExpiryDate.CssClass = "MenuItemDatePicker"
        btnEditRightArrow.Enabled = True
        btnEditLeftArrow.Enabled = True
        btnReadLeftArrow.Enabled = True
        btnReadRightArrow.Enabled = True
        cboxIsActive.Enabled = True
  
    End Sub
  
    Private Sub CloseForm()
        Me.Visible = False
    End Sub
  
#End Region
  
#Region "RadCombo LoadonDemand"
  
    Private Shared Function GetStatusMessage(ByVal offset As Integer, ByVal total As Integer) As String
        If total <= 0 Then
            Return "No matches"
        End If
  
        Return [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total)
    End Function
  
    Private Shared Sub DisplaySelection(ByVal comboBox As Telerik.Web.UI.RadComboBox, ByVal label As Label)
        If comboBox.Text <> [String].Empty Then
            label.Text = "You selected text: <b>" + comboBox.Text + "</b> and value: <b>" + comboBox.SelectedValue + "</b>"
        Else
            label.Text = "ListBox is empty"
        End If
    End Sub
  
    Protected Sub rcmbExisting_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
        Dim oResources As New Resources
        Dim sSearchText As String = e.Text
  
        Dim data As DataTable = oResources.getAllActiveResources(UserCredentials.UserID, rblMenuItemType.SelectedValue, sSearchText)
  
        Dim itemOffset As Integer = e.NumberOfItems
        Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
        e.EndOfItems = endOffset = data.Rows.Count
  
        For i As Integer = itemOffset To endOffset - 1
            rcmbExisting.Items.Add(New Telerik.Web.UI.RadComboBoxItem(data.Rows(i)("menu_resource_title").ToString(), data.Rows(i)("menu_resource_id").ToString()))
        Next
  
        e.Message = GetStatusMessage(endOffset, data.Rows.Count)
    End Sub
  
    Protected Sub ddlLink_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
        Dim oResources As New Resources
        Dim sSearchText As String = e.Text
  
        Dim data As DataTable = oResources.getAllActiveResources(UserCredentials.UserID, rblMenuItemType.SelectedValue, sSearchText)
  
        Dim itemOffset As Integer = e.NumberOfItems
        Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
        e.EndOfItems = endOffset = data.Rows.Count
  
        For i As Integer = itemOffset To endOffset - 1
            ddlLink.Items.Add(New Telerik.Web.UI.RadComboBoxItem(data.Rows(i)("menu_resource_title").ToString(), data.Rows(i)("menu_resource_id").ToString()))
        Next
  
        e.Message = GetStatusMessage(endOffset, data.Rows.Count)
    End Sub
  
#End Region
  
End Class

Hi Yana,

Here is my VB code. Please suggest solution as I have to make it live soon.

Thanks,
Reena

 

 

 

 

0
Yana
Telerik team
answered on 30 Nov 2010, 05:13 PM
Hello,

We need a runnable page or a live url which we can easily test. You can open a support ticket and send us the credentials there. Thanks in advance

All the best,
Yana
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
support
Top achievements
Rank 1
Answers by
Yana
Telerik team
support
Top achievements
Rank 1
Share this question
or