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

Problem getting client-side sample working

1 Answer 49 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 04 Sep 2008, 10:03 PM
I created a new ASP.NET Web Application targeting the 3.5 framework and added a reference to the Telerik controls. I receive a Javascript error "Object doesn't support this property or method" when I click on the box.  It is occuring on the eventArgs.set_cancel(true); line and it causes the sample to not behave as expected.

What am I missing?  I was browsing the documentation and didn't see anything related to this.

Below is the entire aspx file.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager runat="server" />
       <telerik:RadComboBox ID="RadComboBox1" runat="server"
         EnableLoadOnDemand="true" OnClientItemsRequested="OnClientItemsRequestingHandler">
       </telerik:RadComboBox>
    </div>
    </form>
    <script type="text/javascript" language="javascript">
function OnClientItemsRequestingHandler(sender, eventArgs)
{
   if (eventArgs.get_text().length < 3)
      eventArgs.set_cancel(true);
   else
      eventArgs.set_cancel(false);
}
</script>
</body>
</html>


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Sep 2008, 06:10 AM
Hi Brian,

From what I understand the set_cancel() method is not supported by OnClientItemsRequested event. Try your code in the OnClientItemsRequesting event ans see if it is working.

ASPX:
 <telerik:RadComboBox ID="RadComboBox1" EnableLoadOnDemand="true" runat="server" AllowCustomText="true"   OnClientItemsRequesting="OnClientItemsRequesting"  > 
        </telerik:RadComboBox> 

JS:
 <script type="text/javascript" language="javascript" > 
     
    function OnClientItemsRequesting(sender, eventArgs) 
    { 
      if (eventArgs.get_text().length < 3
     eventArgs.set_cancel(true) 
   else 
     eventArgs.set_cancel(false); 
    } 
 </script> 

Thanks
Shinu.
Tags
ComboBox
Asked by
Brian
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or