RadComboBox OnClientKeyPressing UpperCase .

2 posts, 0 answers
  1. salvio
    salvio avatar
    17 posts
    Member since:
    Oct 2010

    Posted 23 Apr 2011 Link to this post

    Hi All,

     I am Using the below JS to Coverting SmallCase to UpperCase for textbox... Can u pls guide me
    how to do the same thing for RadCombobox on KeyPressing...


    function cUpper(cObj) {
                cObj.value = cObj.value.toUpperCase();
            }
      
    aspx:
     <asp:TextBox ID="TextBox1" runat="server" OnKeyup="return cUpper(this)"></asp:TextBox>
     
    <telerik:RadComboBox runat="server" EmptyMessage="Choose Port Cd." EnableLoadOnDemand="True"
               HighlightTemplatedItems="True" DropDownWidth="500px" Skin="Telerik" Height="150px"
                Width="150px" ID="Rc_prtcd" AutoPostBack="True" ShowMoreResultsBox="true"
                  EnableVirtualScrolling="true">
                         <HeaderTemplate>
                                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                                        <tr>
                                            <td style="width: 100px;">
                                             Port Code
                                            </td>
                                            <td style="width: 200px;">
                                                Port Name
                                            </td>
                                             <td style="width: 200px;">
                                               Country Name
                                            </td>
                                        </tr>
                                    </table>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <table cellpadding="0" cellspacing="0" style="width: 100%">
                                        <tr>
                                            <td style="width: 100px;">
                                                <%# DataBinder.Eval(Container, "Text")%>
                                            </td>
                                            <td style="width: 200px;">
                                                <%#DataBinder.Eval(Container, "Attributes['Port_Name']")%>
                                            </td>
                                            <td style="width: 200px;">
                                                <%#DataBinder.Eval(Container, "Attributes['Country_Name']")%>
                                            </td>
                                        </tr>
                                        <hr />
                                    </table>
                                </ItemTemplate>
                                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                            </telerik:RadComboBox>
     


    Thanks
    Salvio
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Apr 2011 Link to this post

    Hello Salvio,

    Try the following  code in OnClientKeyPressing event to change the input text to uppercase.

    aspx:
    <telerik:RadComboBox  ID="RadComboBox3"  AllowCustomText="true" DropDownControlType="RadComboBox"  runat="server"  OnClientKeyPressing="ChangeToUpperCase" >
    </telerik:RadComboBox>

    Javascript:
    function ChangeToUpperCase(sender, args)
     {
          var inputElement = sender.get_inputDomElement();
          inputElement.style.textTransform = "uppercase";
      }

    Thanks,
    Shinu.
Back to Top