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

RadCombobox Selected Value empty

3 Answers 541 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Eric Bradley
Top achievements
Rank 1
Eric Bradley asked on 24 Apr 2013, 04:57 PM
Hi, We've upgraded our application from RadControls ASP.net Q3 2012 to Q1 2013. We now have a problem with SelectedValue when binding data to the radCombobox. For some reason the SelectedValue isn't set to the first item added. It works fine using Q3 2012 so wondering if you've heard issues.

This issue is what we are experiencing

http://www.telerik.com/support/pits.aspx#/details/Issue=2147

Thanks
Eric

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 29 Apr 2013, 02:30 PM
Hello Eric,

 
I have inspect eh the scenario you described but could not observe the unusual behavior. Would you please share the exact code that you use that works fine with Q3 2012 and does not work with Q1 2013 so we could inspect it and be more helpful?

Regards,
Plamen
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
Eric Bradley
Top achievements
Rank 1
answered on 30 Apr 2013, 01:04 PM

Hi Plamen, Here is the code that we are using. The error is raised at this line "if (int.Parse(rcbStageId.SelectedValue) == 4. For some reason the first record added to rcbStageId isn't set as the selectedValue.

Thanks for your help

<telerik:RadComboBox ID="rcbStageId" runat="server" MarkFirstMatch="True"
    Width="135px" MaxHeight="200px"  AutoPostBack="True"
    meta:resourcekey="rcbStageIdResource1"
    onselectedindexchanged="rcbStageId_SelectedIndexChanged">
   <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
 
 
protected void Rebind_rcbStageId()
        {
            P3StageCollection items = new P3StageCollection();
            // items to fetch is the total number of items displayed currently, plus
            // the amount requested each fetch
            IPredicateExpression filter = new PredicateExpression();
            ISortExpression sorter = new SD.LLBLGen.Pro.ORMSupportClasses.SortExpression();
            if (LanguageSelected == BaseLanguage.LanguageType.English)
                sorter.Add(P3StageFields.DescEn | SortOperator.Ascending);
            else
                sorter.Add(P3StageFields.DescFr | SortOperator.Ascending);
 
            IRelationCollection relations = new RelationCollection();
 
            items.GetMulti(filter, 1000, sorter, relations);
            string value = rcbStageId.SelectedValue;
            rcbStageId.Items.Clear();
            if (P3ProjectFields.StageId.IsNullable)
            {
                RadComboBoxItem rcbItem = new RadComboBoxItem("", "");
                rcbStageId.Items.Add(rcbItem);
            }
            foreach (P3StageEntity item in items)
            {
                if (LanguageSelected == BaseLanguage.LanguageType.English)
                {
                    RadComboBoxItem rcbItem = new RadComboBoxItem(item.DescEn.ToString(), item.StageId.ToString());
                    rcbStageId.Items.Add(rcbItem);
                }
                else
                {
                    RadComboBoxItem rcbItem = new RadComboBoxItem(item.DescFr.ToString(), item.StageId.ToString());
                    rcbStageId.Items.Add(rcbItem);
                }
            }
            if (value != "")
            {
                rcbStageId.SelectedValue = value;
            }
            if (int.Parse(rcbStageId.SelectedValue) == 4)
            {
                dtActualEndDate.Enabled = true;
                lbl_dtActualEndDate.Enabled = true;
            }
        }
0
Plamen
Telerik team
answered on 03 May 2013, 11:25 AM
Hello Eric,

 
Thank you for contacting us again and providing the code used.

I have isolated the issue to a sample web page with only a RadComboBox and a Button which is adding an item in it. Unfortunately could not observe any difference in the behavior between the two versions of RadControls.

I am attaching my sample test project. Please review it and let me know if I have to add something else to be able to observe the described issue and be able to help you.

Greetings,
Plamen
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.
Tags
ComboBox
Asked by
Eric Bradley
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Eric Bradley
Top achievements
Rank 1
Share this question
or