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

MarkFirstMatch=true and SelectedValue issue

4 Answers 160 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 10 May 2010, 08:51 PM
We just discovered an issue with some RadComboBox behavior that doesn't seem quite right. We recently set the MarkFirstMatch="true" property and were running into new errors due to the combo box's SelectedValue="". It seems as though when this property is set to true that the combo box does not default to the first item during page load like it normally does. However, after the page is loaded the SelectedValue is correctly set to the first item in the drop down. 
        protected void btnTest_Click(object sender, EventArgs e) 
        { 
            MessageBox.Show(m_ddltest.SelectedValue.ToString()); 
        } 
 

To recreate this scenario we setup a little test project. Please note that the combo box is never clicked during this test. We simply load it and expect (by default) that the first item in the combo box should be selected by default.

Mark-up
    <telerik:RadComboBox ID="m_ddltest" runat="server" MarkFirstMatch="true"></telerik:RadComboBox> 
    <tst:TstButton ID="m_btnTest" runat="server" OnClick="btnTest_Click" /> 
 

Code in Page_Load where we load up the combo box. If you step through this code you will see that the SelectedValue = ""
        protected void Page_Load(object sender, EventArgs e) 
        {                
           m_ddltest.DataSource = InsuredUnitsFromSession; 
           m_ddltest.DataValueField = "InsuredUnitId"
           m_ddltest.DataTextField = "Name"
           m_ddltest.DataBind(); 
 
           string test = m_ddltest.SelectedValue.ToString(); 
        } 

However, when you click the test button the SelectedValue property is now correctly set. Why is the SelectedValue = "" during the loading of the combo box in Page_Load?
        protected void btnTest_Click(object sender, EventArgs e) 
        { 
            MessageBox.Show(m_ddltest.SelectedValue.ToString()); 
        } 
 

Thanks in advance for your assistance.
Jonathan


4 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 13 May 2010, 05:16 PM
Hi Jonathan,

Thank you for the thorough explanation of the issue.

I logged it in our Issue Tracking System and updated your Telerik points for the report. You can track the status of the issue here.

Please expect a fixed Internal Build to be available in the upcoming weeks.

Greetings,
Simon
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 24 Mar 2012, 03:59 PM
Was this issue ever solved?

It is listed as "Resolved" but we seem to experience the same problem, or at least a very similar. We have uses MarkFirstMatch=True but this only seem to happen after pageload, as our ObjectDataSource received nothing as SelectedValue (it is null). Once page is loaded it first row gets selected though, but by then it it to late and our RadGrid will be empty because of the RadComboBox having no selected value at DataBind

We are using latest release of Telerik.
0
Simon
Telerik team
answered on 25 Mar 2012, 06:28 PM
Hi Patrik,

The SelectedValue property depends on many other variables including the MarkFirstMatch funtionality and it is possible that there are still (although few) cases where problems arise.

Please provide us with a sample that shows your problem (via a support ticket or a public link here), so we can debug it and see where the cause lies.

All the best,
Simon
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
FvLent
Top achievements
Rank 2
answered on 16 Apr 2012, 01:10 PM
I had the same problem!

After removing the
AutoCompleteSeparator=";"
entry the SelectedValue behaviour worked fine again!
In fact, the SelectedValue worked too when using
AutoCompleteSeparator=";"
and MarkFirstMatch="true"

but the shown item was the first item of the combobox. When you opened the combobox, 
you could see the selecteditem being selected, because it had the selected background color.

Regards

Frank
Tags
ComboBox
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Simon
Telerik team
improwise
Top achievements
Rank 1
Iron
Iron
FvLent
Top achievements
Rank 2
Share this question
or