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

RadComboBox looses selected item when click on other parts of page

14 Answers 493 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 02 Oct 2009, 04:18 PM
I have the lastest edition of Radcontrols installed here.  However I am developing for Sitefinity 3.7 SP1.  I place a Radcombo box into a user control and populated the control using linqtosql.  Then added a search button to search the database. 

<asp:LinqDataSource ID="LinqDataSource2" runat="server"   
    ContextTypeName="Offices.BillingDataClassesDataContext" OrderBy="Name"   
    TableName="sc_Tribunals" Select="Distinct">  
</asp:LinqDataSource> 
<telerik:RadComboBox ID="rcbSearchBox" Runat="server"   
    DataSourceID="LinqDataSource2" DataTextField="Name" DataValueField="OfficeId"   
    MarkFirstMatch="True" AllowCustomText="True">  
</telerik:RadComboBox> 
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"   
    Text="Search By City" /> 


The RadComboxBox appears work find with small amount of items lets say 10 items loaded.    The OfficeId value type is a GUID, and the DataTextField is a just a string contain city names.

If I select an item near the bottom of the dropdown then click anywhere on the page, the selected item drops and the RadCombo box selects an item near the top of the list.  I found this to be the case with the lastest version of Firefox and IE8/7. 

Am I missing something.

14 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 07 Oct 2009, 11:29 AM
Hello David ,

We could not reproduce the problem in our RadComboBox / LinqDataSource demo. Can you reproduce the problem outside Sitefinity (in a blank new web application)? Are the values of the items really unique?

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
David
Top achievements
Rank 1
answered on 07 Oct 2009, 12:20 PM
Thanks for getting back with me. I ended up just loading the Office Name into the Combo box and dropping the OfficeID.  
My solution was to load the combo on form load.  I loaded my Office Name into a list and check for duplicates then biinded the list to the control

When I get caught up here I will go back try using GUID again with this approach to see if if happens again.  I think the OfficeId(Guid) should be a unique value since it is my primary key in the database table.  

I did have a layout problem with IE8 where the combo box would run under the command button next to it.  My work around for that was just set up a table with two columns.

Thanks for the reply, I will did dig in to this when I get caught up and let you know if I find anything.   I really do like the RadCombo box, this was the first time I had use for it.

David
0
Pascal
Top achievements
Rank 1
answered on 12 Oct 2009, 01:40 PM
We've got the same issue, for some of our RadComboBoxes. In Firefox, once you leave these boxes, automatically some other item, mostly the last item is selected. Unfortunately I was not able to reproduce this issue in a separate project. Even if I don't use the value property (like David suggested) the same problem occurs. I noticed that it only occurs for the combo boxes which contain items with text and spaces. Some other Boxes which only contain numbers work fine.

Could you maybe give me some hints how to debug this problem? I am using FireBug, and was inspecting this issue, I tried to set some break points but they were not passed. Do you have any ideas where I should set a break point to check what's going on, or which values to check?
0
Veselin Vasilev
Telerik team
answered on 14 Oct 2009, 08:58 AM
Hi Pascal,

The best way to proceed would be to send us a sample project where we can reproduce the issue locally. We will debug our code and find where the problem is.

Thanks

Sincerely yours,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Pascal
Top achievements
Rank 1
answered on 15 Oct 2009, 09:09 AM
Finally we figured out the cause for our problem. It seems to be again a conflict between an other third party component (esri) and the rad components. We had an issue like this before and you figured out a solution. We hope there is a solution to this problem also. I will file in a sample project with a support ticket.
0
Matt
Top achievements
Rank 1
answered on 15 Jan 2010, 07:03 PM
Was there ever a reproduction of this at Telerik?  I'm running across the same thing (select a value in the combobox, click anywhere outside of the combobox and the value is changed).

In my case, however, it only happens sometimes.  (Also, when I use the keyboard to make the change and then tab to the next control, the selected value typically stays selected -- no change takes place.)
0
Pascal
Top achievements
Rank 1
answered on 18 Jan 2010, 09:46 AM
They answered us this and it solved the problem:

"Looks like this is a bug in our RadControls for ASP.NET AJAX which has nothing to do with ESRI's controls. When you specify Filter the AllowCustomText mode is automatically switched on, but seems its not properly initialized. So, as a workaround try setting radComboBox.AllowCustomText = true after creating the controls in Page_Load."
0
Matt
Top achievements
Rank 1
answered on 18 Jan 2010, 01:42 PM
Thanks, but unfortunately, that didn't do the trick.

I *did* notice, however, that the selection changes ONLY when a non-unique first word value is selected.  For example, if I load the following into a combo box:

Search 1
Search 2
Search 3
Object Type
Object Form
Created By
Creation Date
Creation Time

and select Search 2 or Search 3, when I click anywhere outside the combo box, Search 1 gets selected.  If I select Object Form, Object Type is selected and when I select Creation Time, Creation Date is selected.

It appears this has to do with the first word in the list vs. anything else.  Is there a setting I'm missing?  Here's the code for the combo box declaration:

<telerik:RadComboBox  
   ID="cboKeywordFields"  
   EnableLoadOnDemand="true"  
   OnChange="MakeDirty()"  
   runat="server"  
   Width="300" /> 
0
Veselin Vasilev
Telerik team
answered on 20 Jan 2010, 03:14 PM
Hi Matt,

Please make sure that the items have different Value properties. If two items have the same Value - the combobox will chose the first one even if you selected the second one.

Try setting unique Value property for each items and I believe the problem will not manifest.

Regards,
Veskoni
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Balageetha
Top achievements
Rank 1
answered on 19 Aug 2014, 07:50 AM
I am also facing the same problem but i didnt get the solution yet. Rad combobox with Ajax is not focusing the selected value.The same problem mentioned above.The values are Unique only.but i didnt get the solution.

Waiting for the Solution.

Thanks
0
Shinu
Top achievements
Rank 2
answered on 19 Aug 2014, 08:21 AM
Hi Balageetha,

I guess you want to select an Item from RadComboBox on blur. Please check the below sample code snippet which works fine at my end. Please elaborate your requirement if it doesn't help.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rcboTestItems">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rcboTestItems" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadComboBox ID="rcboTestItems" runat="server" EmptyMessage="select" OnClientBlur="selectItem">
    <Items>
        <telerik:RadComboBoxItem Text="Item1" Value="1" />
        <telerik:RadComboBoxItem Text="Item2" Value="2" />
        <telerik:RadComboBoxItem Text="Item3" Value="3" />
    </Items>
</telerik:RadComboBox>

JavaScript:
<script type="text/javascript">
    function selectItem(sender, args) {
        sender.findItemByValue("2").select();
    }
</script>

Thanks,
Shinu.
0
Balageetha
Top achievements
Rank 1
answered on 19 Aug 2014, 10:30 AM
Hi shinu,
               Thanks for your reply.

               I didn't get the solution.I am using a RadCombobox inside a Rad List View which is ajaxified and contains a Item Template and EditItem Template.

               The Rad combobox is within the Edit Item Template
.aspx
=====
<rad:RadComboBox ID="ddlStatus" runat="server" Width="100px" DropDownWidth="200"
                                                                AppendDataBoundItems="true">
                                                                <Items>
                                                                    <rad:RadComboBoxItem Text="None" Value="0" />
                                                                </Items>
                                                            </rad:RadComboBox>

               i am binding this combo box in the server side in the RadListView_ItemCreated event as follows,
.aspx.cs
=======

  protected void RadListView_ItemCreated(object sender, RadListViewItemEventArgs e)
        {
            if (e.Item.ItemType == RadListViewItemType.EditItem)
            {

                RadListViewDataItem item = e.Item as RadListViewDataItem;
                string ChecklistHeaderId = item.GetDataKeyValue("ChecklistHeaderId").ToString();
                string InspectionChecklistItemID = item.GetDataKeyValue("InspectionChecklistItemID").ToString();
                string checklistItemStatus = item.GetDataKeyValue("checklistItemStatus").ToString();
                RadDropDownList statusCombo = (RadDropDownList)e.Item.FindControl("ddlStatus");
                statusCombo.DataSource = MOCAdministration_BLL.FetchChecklistStatusItemByChecklistHeaderID(iProcess.Util.IProConvert.toInt32(ChecklistHeaderId));
                statusCombo.DataValueField = "ChecklistStatusHeaderID";
                statusCombo.DataTextField = "StatusDesc";
                //statusCombo.DataBind();
                // statusCombo.Items.Insert(0, new RadComboBoxItem("None", "0"));
                if (statusCombo.Items.Count > 0)
                    statusCombo.SelectedValue = checklistItemStatus != null ? checklistItemStatus : "0";
            }
        }




















0
Balageetha
Top achievements
Rank 1
answered on 19 Aug 2014, 10:58 AM
Hi shinu,

          It is working fine now.


Thanks.
0
VIRUX
Top achievements
Rank 1
answered on 26 Jul 2019, 05:50 AM

""Try setting unique Value property for each items and I believe the problem will not manifest.""

This solved my case. 

After select, ajax post back then click anywhere on page ( left/right ) cause reset to select first item again default.

My case cause by non-unique value with data. Thanks.

Tags
ComboBox
Asked by
David
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
David
Top achievements
Rank 1
Pascal
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Balageetha
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
VIRUX
Top achievements
Rank 1
Share this question
or