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

Bug with EmptyMessage?

12 Answers 156 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 27 Apr 2009, 12:46 PM
Hi,

I'm trying to work out why my code isn't working with the  "control_name.EmptyMessage = message" type command from server side code.  It works when running in the initial page load but then on ajax calls it doesn't set the fields.

Also in Javascript the set_emptyMessage command doesn't seem to work on a similar basis...Interestingly I can use the set_text command to acheive the same goal. 

Is there a known bug with the emptymessage commands or will I need to post some code?

Regards,

Jon

12 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 28 Apr 2009, 12:33 PM
Hello Jon,

We haven't such a known bug with the EmptyMessage property of RadComboBox. Could you please send us a sample which demonstrates the issue to examine it locally?

Sincerely yours,
Helen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon
Top achievements
Rank 1
answered on 28 Apr 2009, 01:26 PM
Hi Helen,

Short of posting the whole page code on the forum (which I'd prefer not to do) is there an email address that I can send the code to? 

Regards,

Jon
0
Paul
Telerik team
answered on 28 Apr 2009, 02:28 PM
Hello Jon,

I'd suggest you open a formal support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Thanks,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon
Top achievements
Rank 1
answered on 28 Apr 2009, 03:36 PM
Hi Paul,

I'll post some relevant bits of the code here as I don't have the time to rebuild the page in a simpler format :(

It now looks as though this issue affects the SelectedValue field as well as EmptyMessage so I suppose that it is something quite basic and will affect more fields in the control.  The really odd thing is that the data in the control gets populated just fine but anything else doesn't work.

Essentially I've got multiple cascading drop downs and they are all setup using your methods posted on this site. 

In the following code the LoadClients is triggered from the PageLoad event and using a ClientID value from the DataBound event I can get that to select the existing value and if necessary set the emptyMessage.  LoadClients calls LoadComboBox to do the database load. 

The part that fails is the LoadContacts, it is called in javascript on the PageLoad event.  It is called with the selected ContactID value and debugging the code I can see the value going into the LoadComboBox sub.  Once the page loads, all of the values are in the drop down but there is no selected value....  Very weird.

It's all very fustrating as the effort to get cascading drop downs working is pretty immense.  This is the last hurdle for me now. 

   Protected Sub LoadComboBox(ByVal comboBoxControl As StringByVal idField As StringByVal textField As StringByVal unselectedMessage As StringByVal sqlString As StringOptional ByVal selectedValue As String = ""Optional ByVal storedProcedure As Boolean = FalseOptional ByVal parameterArray() As String = NothingOptional ByVal valueArray() As String = Nothing)  
        Dim sqlConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)  
 
        Dim sqlDataAdapter As New SqlDataAdapter(sqlString, sqlConnection)  
        If storedProcedure Then sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure  
        If parameterArray IsNot Nothing AndAlso valueArray IsNot Nothing AndAlso parameterArray.Length() = valueArray.Length() Then 
            For i As Integer = 0 To UBound(parameterArray)  
                sqlDataAdapter.SelectCommand.Parameters.AddWithValue(parameterArray(i), valueArray(i))  
            Next 
        End If 
 
        Dim dataTable As New DataTable()  
        sqlDataAdapter.Fill(dataTable)  
 
        Dim uxRadComboBox As RadComboBox = DirectCast(uxFormView.FindControl(comboBoxControl), RadComboBox)  
        uxRadComboBox.DataTextField = textField  
        uxRadComboBox.DataValueField = idField  
        uxRadComboBox.DataSource = dataTable  
        uxRadComboBox.DataBind()  
 
        If selectedValue <> "" Then uxRadComboBox.SelectedValue = selectedValue  
        If unselectedMessage <> "" Then uxRadComboBox.EmptyMessage = unselectedMessage  
    End Sub 
 
    Protected Sub LoadClients()  
        LoadComboBox("uxClient""ClientID""Name""""usp_CRUD_CLI_ClientsSelectByContactPermissions", _clientID, TrueNew String() {"@contactID"}, New String() {Session.Item("ContactID").ToString()})  
    End Sub 
 
    Protected Sub LoadContacts(ByVal dataID As String)  
        Dim valueArray() As String = dataID.Split(","c)  
        Dim selectedValue As String = "" 
        If valueArray.Length = 2 Then selectedValue = valueArray(1)  
        LoadComboBox("uxContact""ContactID""ContactName"" - Select a Contact - ""usp_CRUD_CON_ContactsSelectByClient", selectedValue, TrueNew String() {"@ClientID"}, New String() {valueArray(0)})  
    End Sub 

Thanks in advance for any help!

Regards,

Jon

PS.  It's worth noting that this post below is similar although it seems to indicate that a fix was due (I have the most recent version - 2009.1.402.35)
http://www.telerik.com/community/forums/aspnet-ajax/combobox/combobox-and-emptymessage.aspx
0
Jon
Top achievements
Rank 1
answered on 28 Apr 2009, 07:34 PM
Also worth noting on this is that all of the drop downs that are affected end up with their font being Italic for ALL values not just the top empty message....
0
Helen
Telerik team
answered on 29 Apr 2009, 08:43 AM
Hi Jon,

We tried to reproduce the problem at our samples, but without much success. Please find attached our test files for details. Is it possible to modify them so we to be able to see the exact problem locally?

Regards,
Helen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon
Top achievements
Rank 1
answered on 29 Apr 2009, 10:46 AM
Hi Helen,

They work fine!  Typical.

I suspect that the problem revolves around me having to use the DirectCast as the control is within a formview and hence the code behind can't see the control except via a search (Dim uxRadComboBox As RadComboBox = DirectCast(uxFormView.FindControl(comboBoxControl), RadComboBox))

I'm stuffed for time now so can't play with the code much for now.

Your example did show me one thing that has given me a good work around.  I was assuming that because of the load triggering a child load that I couldn't put the children into the PageLoad.  In your example you did that and it worked. As such I've had a stab and it works fine for me.  I suppose that it's in the name isn't it - onclientselectedindexchanging?  Client - not server.

Given that the controls are now populated in the initial server page load, the font problem has also disappeared!  I wonder if the problem stems from the fact that the child controls don't get setup properly when the page loads initially (no databinding done on them).

The following is the Contact drop down box that is affected by the problem:
<telerik:RadComboBox ID="uxContact" Runat="server"  EmptyMessage=" - Select a Client - " AllowCustomText="true" 
    CssClass="fullWidthTextBox" 
    onitemsrequested="uxContact_ItemsRequested" 
    OnClientItemsRequested="DropDownLoaded">  
</telerik:RadComboBox> 

If I get time over the next few weeks I'll try and look into it some more.

Thanks for the assistance,

Regards

Jon
0
SUNIL
Top achievements
Rank 2
Iron
answered on 30 Oct 2015, 11:59 PM

I found a similar issue when using client-side api to change the empty message.

After some trying I found that the method of set_emptyMessage by itself will not update the empty message of radcombobox, but if you call clearSelection method on client-side, then the new empty message will show for the radcombobox.

 I am using Q3 2015 version. May be a Telerik support professional can confirm this.

combo2.set_emptyMessage("Select a deleted Product to Recover");
combo2.clearSelection();//this line is needed for new empty message to show up

0
SUNIL
Top achievements
Rank 2
Iron
answered on 31 Oct 2015, 02:40 PM
In my situation, with reference to my above post, the combobox had no items initially, and then when an item was added from client-side to this empty combobox, the empty message did not change even though set_emptyMessage api was used and there was no item selected.
0
Helen
Telerik team
answered on 02 Nov 2015, 09:47 AM
Hi,

Could you please open a support ticket and send us your complete code, which will help us to understand the problem better?


Regards,
Helen
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
SUNIL
Top achievements
Rank 2
Iron
answered on 05 Nov 2015, 06:37 PM

Hi Helen,

You are right.

Actually in my scenario, I had 2 RadComboxes with checkboxes, and when I transfered  checked items on client-side from one to another, I did not uncheck these items when adding tto the second RadComboBox.   By calling clearSelection, it seems the items added to second RadComboBox got unchecked which then displayed the empty message. If I did not call clearSelection method on second RadComboBox, then it showed an empty text and also no empty message.

Thanks

Sunil

 

0
Helen
Telerik team
answered on 10 Nov 2015, 12:59 PM
Hi,

As I already mentioned below we are not sure about the exact your scenario. This particular solution works for your case, but it is not necessary in general.

Please send us a sample project which demonstrates the issue to investigate it locally.

Regards,
Helen
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Jon
Top achievements
Rank 1
Answers by
Helen
Telerik team
Jon
Top achievements
Rank 1
Paul
Telerik team
SUNIL
Top achievements
Rank 2
Iron
Share this question
or