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

How to remove html tags from Radcombobox on event of onblur

0 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Manish
Top achievements
Rank 2
Manish asked on 14 Oct 2011, 07:07 AM
Hi,

I am using rad combobox and i want to do that when any <HTML> tag insert in combobox after that user go to click GO button than it should become HTML. I am able to do it on simple asp text box but not able to do it on combobox.

Code example:

On TextBox :
  <script type="text/javascript">
        //remove space from log text box
function RemoveSpecialSymbols(id) {
            var objid = document.getElementById(id);
            if (objid)
                objid.value = html2entities(objid.value);
        }

        function html2entities(sometext) {
            var re = /[<>]/g
            //    if (sometext.length > 2500)
            //        sometext = sometext.substr(0, 2500);
            return sometext.replace(re, function (m) { return replacechar(m) })
        }

        function replacechar(match) {
            if (match == "<")
                return ""
            else if (match == ">")
                return ""
        }
  </script>
<asp:TextBox ID="txtEmail" runat="server" TabIndex="1" MaxLength="50" SkinID="RequiredTextBox" onkeydown="javascript:if (event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {RemoveSpecialSymbols(this.id);}};" onblur="RemoveSpecialSymbols(this.id);" ></asp:TextBox>

Same thing i want to do it on RadCombobox....

     <telerik:RadComboBox ID="RCBSearch" runat="server" Width="250px" Height="150px" Text=""
                    ShowToggleImage="false" EmptyMessage="Search by tags, products, business name"
                    EnableLoadOnDemand="true" ShowMoreResultsBox="true" Style="float: left; margin: 0;
                    padding: 0;" EnableVirtualScrolling="true" ShowDropDownOnTextboxClick="false"
                    onkeydown="PressKeyForProfile(this, event)">
                    <WebServiceSettings Method="GetCompanyNames" Path="wsSellWithMe.asmx" />
                </telerik:RadComboBox>

But it is sowing some kind of javascript error...

"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500"

Thanks
Manish

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Manish
Top achievements
Rank 2
Share this question
or