Readonly ?

27 posts, 0 answers
  1. Support ATT
    Support ATT avatar
    66 posts
    Member since:
    Nov 2004

    Posted 09 Jun 2008 Link to this post

    Hi

    How can i set Readonly property for RadCombobox ?

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

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

  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 10 Jun 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Support ATT
    Support ATT avatar
    66 posts
    Member since:
    Nov 2004

    Posted 10 Jun 2008 Link to this post

    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".
  5. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 11 Jun 2008 Link to this post

    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
  6. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 13 Nov 2008 Link to this post


  7. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 13 Nov 2008 Link to this post

    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.
  8. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 27 May 2009 Link to this post


  9. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 28 May 2009 Link to this post

    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.
  10. Stuart
    Stuart avatar
    9 posts
    Member since:
    May 2009

    Posted 01 Oct 2009 Link to this post

    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.

  11. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 02 Oct 2009 Link to this post

    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.
  12. Kris Ivanov
    Kris Ivanov avatar
    4 posts
    Member since:
    Apr 2010

    Posted 15 May 2010 Link to this post

    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.
  13. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 20 May 2010 Link to this post

    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.
  14. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 24 Jun 2010 Link to this post

    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 

  15. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 28 Jun 2010 Link to this post

    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
  16. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 28 Jun 2010 Link to this post

    We use IE8.
    See the extra white line between the border and the input that the arrow is pointing to.
  17. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 06 Jul 2010 Link to this post

    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
  18. Lenny_shp
    Lenny_shp avatar
    343 posts
    Member since:
    Jul 2006

    Posted 06 Jul 2010 Link to this post

    n/a
  19. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 07 Jul 2010 Link to this post

    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
  20. Libby Stainer
    Libby Stainer avatar
    8 posts
    Member since:
    Mar 2010

    Posted 26 Oct 2010 Link to this post

    I agree with Kris Ivanov.
  21. manoj
    manoj avatar
    4 posts
    Member since:
    Nov 2010

    Posted 10 Nov 2010 Link to this post

     

    Hi,

    How can i set Readonly property for RadCombobox ?

  22. Kris Ivanov
    Kris Ivanov avatar
    4 posts
    Member since:
    Apr 2010

    Posted 22 Nov 2010 Link to this post

    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.
  23. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 24 Nov 2010 Link to this post

    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.
  24. Alberto
    Alberto avatar
    11 posts
    Member since:
    Nov 2010

    Posted 06 Dec 2010 Link to this post

    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?
  25. Karlo
    Karlo avatar
    5 posts
    Member since:
    Oct 2011

    Posted 25 Nov 2011 Link to this post

    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); });
                }
            }
  26. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 30 Nov 2011 Link to this post

    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
  27. Carlo
    Carlo avatar
    10 posts
    Member since:
    Dec 2011

    Posted 27 Jan 2014 Link to this post

    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(...
  28. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 30 Jan 2014 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017