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

Unable to pick the first option

4 Answers 73 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kenneth Lo
Top achievements
Rank 1
Kenneth Lo asked on 08 Oct 2008, 08:26 PM
We have a RadComboBox and the data is populated in the code-behind C# page. We are unable to select the first option in the dropdown without previously picking any other item. After which, the first item becomes "unlocked". This issue is particularly problematic when there is only option in the dropdown.

Has anyone encountered and fixed this? Many thanks in advance.

P.S. This only happens in IE7. Firefox runs without any issue.

4 Answers, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 08 Oct 2008, 09:13 PM
Hey Kenneth,

Would you mind posting your source code for this?  I actually set up the same thing today (combo + code-behind population) and the ComboBox automatically sets the first item as the selected item when the page displays, no problems picking anything from the get-go.
0
Kenneth Lo
Top achievements
Rank 1
answered on 09 Oct 2008, 02:30 PM
Hi Serrin: Thanks for your reply. Below is the front-end code.

Ken



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Profile.aspx.cs" Inherits="EMS2AJAX.Profile" %>

<%@ Register Assembly="Telerik.Web.UI, Version=2008.1.619.20, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<div style="font-family: Tahoma">
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Vista" />
<h1>Update Department Information</h1>
    In order to provide users with the easiest routing information, it is important for us to have accurate information about your Organization. Please update your Department. It may take up to 24 hours before your new department information is
        available throughout the system.&nbsp;<br />
       <table>
<tr id="department">
<td style="height: 59px" headers="department list">
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" >
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>   
</td>
<td style="height: 59px" headers="save department">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Update" />
</td>
</tr>
</table>
</div>
    </form>
</body>
</html>
0
Serrin
Top achievements
Rank 1
answered on 09 Oct 2008, 03:48 PM
Hey Ken,

Well, I can't attach anything, so here is my version of that (had to change Telerik declaration up top, I am demo'ing the Q2 '08 build):

ASPX
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head id="Head1" runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
<div style="font-family: Tahoma">  
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Vista" /> 
<h1>Update Department Information</h1> 
    In order to provide users with the easiest routing information, it is important for us to have accurate information about your Organization. Please update your Department. It may take up to 24 hours before your new department information is  
        available throughout the system.&nbsp;<br /> 
       <table> 
<tr id="department">  
<td style="height: 59px" headers="department list">  
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" > 
<CollapseAnimation Duration="200" Type="OutQuint" /> 
</telerik:RadComboBox>     
</td> 
<td style="height: 59px" headers="save department">  
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Update" /> 
</td> 
</tr> 
</table> 
</div> 
    </form> 
</body> 
</html> 

ASPX.CS
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Telerik.Web.UI;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!IsPostBack)  
        {  
            for (int x = 0; x < 10; x++)  
            {  
                RadComboBoxItem rbi = new RadComboBoxItem();  
                rbi.Text = "Item " + x.ToString();  
                rbi.Value = "Item" + x.ToString();  
                RadComboBox1.Items.Add(rbi);  
            }  
        }  
    }  
    protected void Button1_Click(object sender, EventArgs e)  
    {  
        //nothing here :)  
    }  
}  
 

Everything works as expected... so I am starting to think it has something to do with the Q1 release.  Any chance you have a subscription and can download the newest release to test that out? :D
0
Kenneth Lo
Top achievements
Rank 1
answered on 09 Oct 2008, 04:04 PM
Since the original code worked in Firefox, I started stripping off HTML and determined the table tags were causing the issue. Once I removed the table tags, it worked correctly in both IE & FF. Serrin, thanks for checking the code with the Q2 build. I will definitely check it out.
 


<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<div style="font-family: Tahoma">
<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Vista" />
<h1>Update Department Information</h1>
In order to provide users with the easiest routing information, it is important for us to have accurate information about your Organization. Please update your Department. It may take up to 24 hours before your new department information is
available throughout the system.&nbsp;<br />
<br />
<asp:CompareValidator ValueToCompare="Please select a department" Operator="NotEqual" ControlToValidate="RadComboBox1" ErrorMessage="Please select a department" runat="server" ID="Comparevalidator1" />
<br />
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="300px" AppendDataBoundItems="true">
<CollapseAnimation Duration="200" Type="OutQuint" />
<Items>
<telerik:RadComboBoxItem runat="server" Text="Please select a department" />
</Items>
</telerik:RadComboBox>
&nbsp;
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Update" />
</div>
</form>
Tags
ComboBox
Asked by
Kenneth Lo
Top achievements
Rank 1
Answers by
Serrin
Top achievements
Rank 1
Kenneth Lo
Top achievements
Rank 1
Share this question
or