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

Multicolumn radcombo box select one

7 Answers 102 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mac P
Top achievements
Rank 1
Mac P asked on 13 Aug 2010, 10:57 PM
Hello

How do i insert "Select One" in radcombo that have multiple column
something like http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx

When i add radcombo item than it doesnt display in the drop downlist. It display "Blank item". when i select that blank item it display select one in the combo box.

Ideally i want user to see "select one" in rad combo when loaded for the first time.

Regards
Mac

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Aug 2010, 02:51 PM
Hello Mac,

One suggestion would be setting the AllowCustomText and EmptyMessage property of RadComboBox like below.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server"  AllowCustomText="True" EmptyMessage="Select One" >
  . . . . . . . . .
</telerik:RadComboBox>

Thanks,
Princy.
0
Mac P
Top achievements
Rank 1
answered on 16 Aug 2010, 03:18 PM
Thanks Princy for your response.
Unfortunately it doesnt work for my case. I cannot have AllowCustomText to true.
0
Princy
Top achievements
Rank 2
answered on 17 Aug 2010, 06:33 AM
Hello Mac,

In order to achieve this set AllowCustomText as true and add the following client code, which does not allow user to type something in combo.

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server"  AllowCustomText="True" EmptyMessage="Select One" OnClientLoad="OnClientLoad" >
  . . . . . . . . .
</telerik:RadComboBox>

Java Script:
<script type="text/javascript">
    function OnClientLoad(sender, args) {
        var combo = sender;
        var input = combo.get_inputDomElement();
        input.readOnly = true;
      }
 </script>

Thanks,
Princy.
0
Damodar
Top achievements
Rank 1
answered on 31 Jan 2011, 03:47 AM
I am also facing same problem. I can see the text but when I press dropdown button I can't see text inside combobox.
0
Simon
Telerik team
answered on 02 Feb 2011, 11:30 AM
Hi Damodar,

You should call DataBind() on this Item after you add it to the RadComboBox so that the Template applies. In this way it will show the Template contents in the drop down, when the latter is opened.

All the best,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Damodar
Top achievements
Rank 1
answered on 02 Feb 2011, 11:38 PM
Hi Simon,
Thanks for reply,
I have called DataBind() but I cant see that item inside the Combobox.            
            RadComboBoxItem item = new RadComboBoxItem();
            item.Text = row.Departing.ToString();
            item.Value = row.Departing.ToString();
            RadCBDeparting.Items.Add(item);
            RadCBDeparting.DataBind();
            RadCBDeparting.SelectedValue = row.Departing.ToString();            
            
I have 3 columns in the RadComboBox (in design) but I am setting only one value when loading 
Does it make any differnce? Do I have to specify which Item it should assign to? If yes, how to?
<HeaderTemplate>
<table cellspacing="0" cellpadding="0">
    <tr>
        <td style="width:80px">Port Code</td>
         <td style="width:210px">Port Name</td>
         <td style="width:210px">Market Name</td>
    </tr>
</table>
</HeaderTemplate>
<ItemTemplate>
    <table cellspacing="0" cellpadding="0">
    <tr>
        <td style="width:100px">
            <%# DataBinder.Eval(Container.DataItem, "Port_Code") %>
        </td>     
        <td style="width:240px">
            <%# DataBinder.Eval(Container.DataItem, "Port_Name") %>
         </td>
         <td style="width:260px">
             <%# DataBinder.Eval(Container.DataItem, "Market_Name") %>
          </td>                                   
   </tr>
</table>
</ItemTemplate>

Regards,
Damodar     
0
Kalina
Telerik team
answered on 09 Feb 2011, 12:18 PM
Hi Mac P,

Please take a look at the last section of this help article where inserting a default item in a templated RadComboBox is explained.
Additionally I prepared a sample page for you - please find it attached.

Greetings,
Kalina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
Mac P
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Mac P
Top achievements
Rank 1
Damodar
Top achievements
Rank 1
Simon
Telerik team
Kalina
Telerik team
Share this question
or