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

Readonly ?

27 Answers 1873 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Support ATT
Top achievements
Rank 1
Support ATT asked on 09 Jun 2008, 07:44 PM
Hi

How can i set Readonly property for RadCombobox ?

e.g. RadComboBox.Readonly = true, something like that ??

best regards
http://www.sport-events.ch

27 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 10 Jun 2008, 07:06 AM
Hello Toprak,

RadComboBox will be in ReadOnly mode(the user will not be able to enter text, only to select one of the items) if

AllowCustomText ,MarkFirstMatch and EnableLoadOnDemand properties are set to false.

Try it and let us known how this goes.

Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 10 Jun 2008, 08:10 AM
Hi

i have an WebUserControl. Inside of them is RadCombobox with EnableLoadOnDemand feature.

Now, i'm using my webusercontrol in an other form. There i will be set the text directly, without allow the user to select the radcombobox.

public void fillControl(string primaryKey)
{
    radcombobox1.text = "test";
   radcombobox1.enableloadondemand = false;

}

when i make this, i can't see the test text !!

I wish to desable the loadondemand. i will set only the text = "test".
0
Rosi
Telerik team
answered on 11 Jun 2008, 07:34 AM
Hello Toprak ,

You can try the following approach:

<script type="text/javascript">

function pageLoad()
{
    var combo = $find('<%=RadComboBox1.ClientID%>');
    combo.set_text("test");

}

</script>

Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lenny_shp
Top achievements
Rank 2
answered on 13 Nov 2008, 03:38 PM

0
Atanas Korchev
Telerik team
answered on 13 Nov 2008, 04:20 PM
Hi Lenny_shp,

RadComboBox does not support readonly mode. You can however try disabling it.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lenny_shp
Top achievements
Rank 2
answered on 27 May 2009, 02:28 PM

0
Paul
Telerik team
answered on 28 May 2009, 11:59 AM
Hi Lenny_shp,

Please find below a sample code snippet that shows the needed approach.

<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
    <style type="text/css">  
    .RadComboBox_Outlook .rcbDisabled td.rcbInputCellLeft  
    {  
        background-image: none !important;  
        background-color: InactiveBorder;  
    }  
    </style> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
    <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="Outlook" Enabled="false">  
        <Items> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" Value="RadComboBoxItem4" /> 
        </Items> 
    </telerik:RadComboBox> 
    <asp:TextBox runat="server" Enabled="false">tetete</asp:TextBox> 
    </form> 
</body> 
</html> 


Best wishes,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Stuart
Top achievements
Rank 1
answered on 01 Oct 2009, 03:36 PM
I'm trying to change the text color of a disabled RadComboBox in CSS using:

 

.RadComboBox_Vista

 

.rcbDisabled

 

{

 

filter: none !important;

 

 

opacity: 1 !important;

 

 

color: Red;

 

}

but I cannot change the text color. Can I change the color of the disabled text?

Thanks.

0
Paul
Telerik team
answered on 02 Oct 2009, 11:22 AM
Hello Stuart,

Here's a sample code snippet that shows the needed approach.

<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
    <style type="text/css"
        .RadComboBox_Vista .rcbDisabled .rcbInputCell .rcbInput, 
        .RadComboBoxDropDown_Vista .rcbDisabled 
        { 
            filter: none !important; 
            opacity: 1 !important; 
            color: Red !important; 
        } 
    </style> 
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadComboBox runat="server" ID="RadComboBox1" Skin="Vista"
        <Items> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1" 
                Enabled="false" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" 
                Enabled="false" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" /> 
        </Items> 
    </telerik:RadComboBox> 
    </form> 
</body> 
</html> 


Greetings,
Paul
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
Kris Ivanov
Top achievements
Rank 2
answered on 15 May 2010, 09:01 PM
It is hard to believe such a powerful control like RadComboBox does not have a ReadOnly property.

I highly recommend to have the functionality implemented due to demand. You know it is extremely easy to add such a functionality.

In a meanwhile the work around is to have RadTextBox, which does have ReadOnly functionality, replacing the RadComboBox when you need it to show as read only. Of course you have to also manage the visibility of those two by toggling based on the need.
0
Simon
Telerik team
answered on 20 May 2010, 01:16 PM
Hi Kris Ivanov,

Since the read-only state of RadComboBox depends on various different behaviors (allowing custom text, client-side highlighting, Load On Demand) introducing yet another property will add only unnecessary confusion.

Currently, RadComboBox is read-only by default. Setting any of the AllowCustomText, MarkFirstMatch, Enable(Automatic)LoadOnDemand to true will disable this.

Best wishes,
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
Lenny_shp
Top achievements
Rank 2
answered on 24 Jun 2010, 02:26 PM
Current approach however there is a slight blank line within the border and the textbox itself I think it's attributed to this.
  
         .Style = "margin-top:-1px;margin-bottom:-1px"



I tried to set additional properties but they do not affect it.

.EnableEmbeddedSkins = False
.EnableEmbeddedBaseStylesheet = False
.DropDownCssClass = String.Empty




    Private Sub DisableRadCombobox(ByVal cntrl As RadComboBox) 
 
        With cntrl 
            .ShowToggleImage = False 
            .AllowCustomText = False 
            .MarkFirstMatch = False 
            .EnableTextSelection = False 
            .EnableLoadOnDemand = False 
            .BackColor = Drawing.Color.Gainsboro 
            '.ForeColor = Drawing.Color.Black   'This doesn't do anything for IE 
            .ShowDropDownOnTextboxClick = False 
            .Skin = String.Empty    'important 
            .AutoPostBack = False 
 
            '.Enabled = False   'Note: due to RadComboBox's rendering for disabled we left it enabled with selected item only 
            Dim tmpItem As RadComboBoxItem = .SelectedItem 
            .Items.Clear() 
            If tmpItem IsNot Nothing Then 
                .Items.Clear() 
                .Items.Add(tmpItem) 
                tmpItem.Selected = True 
            End If 
        End With 
    End Sub 

0
Simon
Telerik team
answered on 28 Jun 2010, 12:28 PM
Hello Lenny_shp,

Can you please provide more information about this issue, perhaps a screenshot? Please also note the version of the browser in which it occurs.

Regards,
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
Lenny_shp
Top achievements
Rank 2
answered on 28 Jun 2010, 03:02 PM
We use IE8.
See the extra white line between the border and the input that the arrow is pointing to.
0
Simon
Telerik team
answered on 06 Jul 2010, 10:14 AM
Hi Lenny_shp,

Thank you for the screenshot.

So I tried reproducing this with the latest version of Telerik.Web.UI and this RadComboBox:
<telerik:RadComboBox ID="RadComboBox1" runat="server" BackColor="Gainsboro" ShowDropDownOnTextboxClick="false"
    Skin="">
</telerik:RadComboBox>

without success.

What I see is the same as the first RCB in your screenshot.

Please let me know the exact version of the Telerik.Web.UI assembly that you use as it may be older and having the bug (which we probably have fixed later).

Best wishes,
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
Lenny_shp
Top achievements
Rank 2
answered on 06 Jul 2010, 06:42 PM
n/a
0
Simon
Telerik team
answered on 07 Jul 2010, 02:23 PM
Hi Lenny_shp,

In this case, we may have to provide you with a workaround for the version you are using.

Please open a support ticket and send us a project (including the dll), which shows the issue.

Kind regards,
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
Libby Stainer
Top achievements
Rank 1
answered on 26 Oct 2010, 04:31 PM
I agree with Kris Ivanov.
0
manoj
Top achievements
Rank 1
answered on 10 Nov 2010, 01:03 PM

 

Hi,

How can i set Readonly property for RadCombobox ?

0
Kris Ivanov
Top achievements
Rank 2
answered on 22 Nov 2010, 11:44 PM
Currently there is no direct way to make RadComboBox read only. You can either use RadTextBox and show the proper one when you need it as read only or selectable or you can do something like that:

radComboBox.ShowDropDownOnTextboxClick = false;
radComboBox.ShowToggleImage = false;
  
foreach (RadComboBoxItem radComboBoxItem in radComboBox.Items)
{
    radComboBoxItem.Enabled = false;
}

Assuming you have radComboBox being your control. This is not optimal but it works fine if you don't want to mess with additional text box controls.
0
Simon
Telerik team
answered on 24 Nov 2010, 02:07 PM
Hi Kris Ivanov,

After reconsidering the possibility of adding the ReadOnly property we came up with a solution you can use now to achieve the required state. You can handle the client-side Load event of the RadComboBox in this way:
function onLoad(sender) {
    var input = sender.get_inputDomElement();
    input.readOnly = true;
    $telerik.$(input).keydown(function (e) { return false; });
    sender.add_dropDownOpening(function (s, e) { e.set_cancel(true); });
}

I hope this helps.

Kind regards,
Simon
the Telerik team
Browse the vast support resources we have to jumpstart 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
Alberto
Top achievements
Rank 1
answered on 06 Dec 2010, 03:36 PM
I tried the script in a RadMultiPage and if the RadComboBox is inserted into a RadPageView different from the first, you can click the same. while the same is not clickable if I put it outside the RadMultiPage or in the first RadPageView of the RadMultiPage.

Can you tell me how can I fix it?
0
Karlo
Top achievements
Rank 1
answered on 25 Nov 2011, 09:28 AM
I tried your solution but i think my "enabling" of combo box does not work correctly.
Well, the drop down gets enabled but the keydown part didn't.
here's my code:
function setRadComboBoxReadOnly(sender, isReadOnly) {
            var input;
            if (isReadOnly) {
                input = sender.get_inputDomElement();
                input.readOnly = true;
                window.$telerik.$(input).keydown(function(e) { return false; });
                sender.add_dropDownOpening(function(s, e) { e.set_cancel(true); });
            } else {
                input = sender.get_inputDomElement();
                input.readOnly = false;
                window.$telerik.$(input).keydown(function (e) { return true; });
                sender.add_dropDownOpening(function (s, e) { e.set_cancel(false); });
            }
        }
0
Simon
Telerik team
answered on 30 Nov 2011, 10:52 AM
Hi Karlo,

In this way you are attaching another keydown event to the input and the old one remains. I suggest you use namespaced events to attach keydown and remove it instead of adding a new handler when you want to restore RadComboBox's state.

Kind regards,
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
Carlo
Top achievements
Rank 1
answered on 27 Jan 2014, 08:42 PM
I put the following code into my code behind to create an effective "readonly" mode for the radcombobox. While I am aware of the many modes the box can be used in, I don't see why there would be consitency issues implementing what I did here in code behind as a standard behaviour for ".ReadOnly" as a property

/// <summary>
/// Makes page readonly
/// </summary>
private void MakeReadOnly()
{
    btnSubmit.Visible         = false;
    btnAutoFill.Visible       = false;
    sdDocuments.DisableDelete = true;
    btnScan.DisableScanning   = true;
 
    foreach(Control Ctrl in Controls) {
        if (Ctrl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
            ((TextBox)Ctrl).ReadOnly = true;
        if (Ctrl.GetType().ToString().Equals("Telerik.Web.UI.RadComboBox"))
            ((RadComboBox)Ctrl).AllowCustomText = ((RadComboBox)Ctrl).MarkFirstMatch = ((RadComboBox)Ctrl).EnableLoadOnDemand = ((RadComboBox)Ctrl).ShowDropDownOnTextboxClick = ((RadComboBox)Ctrl).EnableAutomaticLoadOnDemand = false;                   
    }
}//End private void MakeReadOnly(...
0
Nencho
Telerik team
answered on 30 Jan 2014, 02:35 PM
Hello Carlo,

The ReadOnly state of the RadComboBox has a bit different signification. The control is in ReadOnly state, when the AllowCustomText property is set to false. In other words, when custom text is not allowed to be entered in the control. Therefore, you could manage the Enabled property of the control, in order to achieve the desired functionality.

Regards,
Nencho
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Alvaro
Top achievements
Rank 1
answered on 11 Jul 2017, 07:21 PM

Hi telerik

I have a question; I am using a radcombobox, I setup the "markFirstMatch" as true  but it has the following behavior:

1.If you click over the button with the arrow the options list is shown and the cursor is positioned at the beginning of the selected item text.

 

 

2. Then if you hit a click over the selected item area (not in the button with the arrow) the text on this area is highlighted and the options list is shown.

3. Now if you click again over the button with the arrow, you will see that the text on the selected item area is highlighted that is not the same behavior from the step one.

My question is, is this a normal behavior? or it is a way if you click over the selected item area o radcombobox button the text is highlighted? we have the "Marckfirstmatch" property set to true as the user types the initial letters of the option he wants to select, the list of options changes and is positioned over the one that matches what the user is typing; But if we put the property in false, the list of options only takes into account the first letter and is positioned on the first option that finds with that letter.

In other words, it is possible to have " markfirstmatch="true" " and also select the text of selected item if you click over the selected item area or in the button.

I'm using the following code for the radcombobox.

 <telerik:RadComboBox
                ID="idxCLIENTID"
                Width="270px"
                MarkFirstMatch="true"
                AllowCustomText="false"
                runat="server"
                RenderMode="Lightweight"
                CausesValidation="False"
                AutoPostBack="True">

                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="ANY" Value="ANY" />
                    <telerik:RadComboBoxItem runat="server" Text="all" Value="all" />
                    <telerik:RadComboBoxItem runat="server" Text="alvaro" Value="alvaro" />
                    <telerik:RadComboBoxItem runat="server" Text="juan" Value="juan" />
                    <telerik:RadComboBoxItem runat="server" Text="carlos" Value="carlos" />
                    <telerik:RadComboBoxItem runat="server" Text="allan" Value="allan" />
                    <telerik:RadComboBoxItem runat="server" Text="carla" Value="carla" />
                    <telerik:RadComboBoxItem runat="server" Text="julia" Value="julia" />
                    <telerik:RadComboBoxItem runat="server" Text="Martha" Value="Martha" />
                    <telerik:RadComboBoxItem runat="server" Text="alicia" Value="alicia" />
                    <telerik:RadComboBoxItem runat="server" Text="mauricio" Value="mauricio" />
                </Items>
            </telerik:RadComboBox>

 

Thanks.

Tags
ComboBox
Asked by
Support ATT
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Support ATT
Top achievements
Rank 1
Lenny_shp
Top achievements
Rank 2
Atanas Korchev
Telerik team
Paul
Telerik team
Stuart
Top achievements
Rank 1
Kris Ivanov
Top achievements
Rank 2
Simon
Telerik team
Libby Stainer
Top achievements
Rank 1
manoj
Top achievements
Rank 1
Alberto
Top achievements
Rank 1
Karlo
Top achievements
Rank 1
Carlo
Top achievements
Rank 1
Nencho
Telerik team
Alvaro
Top achievements
Rank 1
Share this question
or