RadComboBox4_SelectedIndexChanged is not working

5 posts, 2 answers
  1. Rita15
    Rita15 avatar
    19 posts
    Member since:
    Feb 2010

    Posted 25 Feb 2010 Link to this post

    Hi,
     I am trying to add 'RadComboBox4_SelectedIndexChanged'  function on the server side code.
    But when I run the application, I am getting the following error message.

    CS1061: 'ASP.relatedcombobox_aspx' does not contain a definition for 'RadComboBox4_SelectedIndexChanged' and no extension method 'RadComboBox4_SelectedIndexChanged' accepting a first argument of type 'ASP.relatedcombobox_aspx' could be found (are you missing a using directive or an assembly reference?)

    My code is:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RelatedComboBox.aspx.cs" Inherits="GridRadControlsWebApplication1.RelatedComboBox" %> 
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
    <!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> 
    <script language="javascript" type="text/javascript">  
     
        function pageLoad() {  
            //updateCombos();  
               
        }  
        function updateCombos() {  
            // initialize the global variables  
            // in this event all client objects  
            // are already created and initialized  
            var combo = $find("<%= RadComboBox1.ClientID %>");  
            var comboSubType = $find("<%= RadComboBox2.ClientID %>");  
            var comboReqBy = $find("<%= RadComboBox3.ClientID %>");  
            alert("test");  
            if (combo.get_value() == "03") {  
                comboSubType.enable();  
            }  
            else {  
                comboSubType.disable();  
            }  
            // add the code to populate ReqBy list  
            if (combo.get_value() == "01") {  
                var comboItem1 = new Telerik.Web.UI.RadComboBoxItem();  
                comboItem1.set_value('01');  
                comboItem1.set_text('01-Complainant');  
     
     
                var comboItem2 = new Telerik.Web.UI.RadComboBoxItem();  
                comboItem2.set_value('02');  
                comboItem2.set_text('02 - Provider');  
     
                comboReqBy.clearItems();  
                comboReqBy.get_items().add(comboItem1);  
                comboReqBy.get_items().add(comboItem2);  
                comboItem1.select();  
                combo.commitChanges();  
     
            }  
            if ((combo.get_value() == "02") || (combo.get_value() == "03") || (combo.get_value() == "04")) {  
     
                var comboItem2 = new Telerik.Web.UI.RadComboBoxItem();  
                comboItem2.set_value('02');  
                comboItem2.set_text('02 - Provider');  
     
                comboReqBy.clearItems();  
                comboReqBy.get_items().add(comboItem2);  
                comboItem2.select();  
                combo.commitChanges();  
     
            }  
            if (combo.get_value() == "05") {  
     
                var comboItem1 = new Telerik.Web.UI.RadComboBoxItem();  
                comboItem1.set_value('03');  
                comboItem1.set_text('03 - CNA');  
     
     
                var comboItem2 = new Telerik.Web.UI.RadComboBoxItem();  
                comboItem2.set_value('04');  
                comboItem2.set_text('04 - DSW');  
     
                comboReqBy.clearItems();  
                comboReqBy.get_items().add(comboItem1);  
                comboReqBy.get_items().add(comboItem2);  
                comboItem1.select();  
                combo.commitChanges();  
     
            }  
          
        }  
          
        function OnIDRTypeChanged() {  
           updateCombos()   
        }  
     
        function LoadReqBy(combo, eventArqs) {  
            var item = eventArqs.get_item();  
            //countriesCombo.set_text("Loading...");  
            comboReqBy.clearSelection();  
     
            // if a IDR type is selected  
            if (item.get_index() > 0) {  
                // this will fire the ItemsRequested event of the  
                // countries combobox passing the continentID as a parameter  
                comboReqBy.requestItems(item.get_value(), false);  
            }  
     
        }  
     
        function ItemsLoaded(combo, eventArqs) {  
            if (combo.get_items().get_count() > 0) {  
                // pre-select the first item  
                combo.set_text(combo.get_items().getItem(0).get_text());  
                combo.get_items().getItem(0).highlight();  
            }  
     
        }   
    </script> 
    <body> 
     
        <form id="form1" runat="server">  
        <div> 
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
            </telerik:RadScriptManager> 
            <telerik:RadComboBox ID="RadComboBox4" runat="server" AutoPostBack="true" 
            OnSelectedIndexChanged="RadComboBox4_SelectedIndexChanged">  
            </telerik:RadComboBox> 
              
              
            <telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="true"   
            OnClientSelectedIndexChanged="OnIDRTypeChanged" > 
              
                <Items> 
                              
                   <telerik:RadComboBoxItem Text="01-Complaint" value="01"/>  
                   <telerik:RadComboBoxItem Text="02-Survey" value="02"/>  
                   <telerik:RadComboBoxItem Text="03-Sanction" value="03"/>  
                   <telerik:RadComboBoxItem Text="04-Application Denials" value="04"/>  
                   <telerik:RadComboBoxItem Text="05-CNA/DSW" value="05"/>  
                              
                          
                </Items> 
            </telerik:RadComboBox> 
              
            <telerik:RadComboBox ID="RadComboBox2" Runat="server">  
            <Items> 
                              
                  <telerik:RadComboBoxItem Text="01-Licensure" value="01" /> 
                  <telerik:RadComboBoxItem Text="02-License Revocation" value="02"/>  
                  <telerik:RadComboBoxItem Text="03-License Denial" Value="03" /> 
                              
           </Items> 
            </telerik:RadComboBox> 
              
            <telerik:RadComboBox ID="RadComboBox3" Runat="server" > 
              
            <Items> 
                              
                            <telerik:RadComboBoxItem Text="01-Complainant" value="01" /> 
                            <telerik:RadComboBoxItem Text="02-Provider" value="02"/>  
                            <telerik:RadComboBoxItem Text="03-CNA" Value="03" /> 
                            <telerik:RadComboBoxItem Text="04-DSW" Value="04" /> 
                              
                            </Items> 
            </telerik:RadComboBox> 
              
          
        </div> 
        </form> 
    </body> 
    </html> 
     

    using System;  
    using System.Collections.Generic;  
    using System.Linq;  
    using System.Web;  
    //using System.Web.UI;  
    //using System.Web.UI.WebControls;  
    using System.Data.SqlClient;  
    using System.Configuration;  
    //using System.Data.DataTable;   
    using System.Data;  
    using Telerik.Web.UI;  
    using Telerik.Web.Design;  
     
     
     
    namespace GridRadControlsWebApplication1  
    {  
        public partial class RelatedComboBox : System.Web.UI.Page  
        {  
            protected void Page_Load(object sender, EventArgs e)  
            {  
                string test = "123";  
            }  
            private void RadComboBox4_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)  
            {  
                string test1 = "12345";  
            }  
            protected void RadComboBox3_ItemsRequested(object o,RadComboBoxItemsRequestedEventArgs e)  
            {  
                // e.Text is the first parameter of the requestItems method  
                // invoked in LoadCountries method  
                LoadReqBy(e.Text);  
            }  
            protected void LoadReqBy(string IDRType)  
            {  
                string connectionString = ConfigurationManager.ConnectionStrings["SQL_AppConString_Dev"].ConnectionString;  
                SqlConnection SqlConnection = new SqlConnection(connectionString);  
     
                //select a country based on the continentID  
                SqlDataAdapter adapter = new SqlDataAdapter("select * from [LOOKUP_VALUES] where TABLENAME='IDR_MAIN' "+  
                " and COLUMNNAME='REQUESTED_BY' AND ALLOWEDTYPES=@IDRType", SqlConnection);  
                adapter.SelectCommand.Parameters.AddWithValue("@IDRType", IDRType);  
     
                DataTable dt = new DataTable();  
                adapter.Fill(dt);  
     
                RadComboBox3.DataTextField = "VALDESC";  
                RadComboBox3.DataValueField = "VALUE";  
                RadComboBox3.DataSource = dt;  
                RadComboBox3.DataBind();  
            }  
        }  
    }  
     

    Any idea??

    Thanks,
    Rita

  2. Answer
    robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 26 Feb 2010 Link to this post

    In your code-behind you have the event declared as private, but it should be declared as protected.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 26 Feb 2010 Link to this post

    Hello Rita Sahoo,

    Thanks for your question.

    Actually the problem is very obvious:

    private void RadComboBox4_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
       {
           string test1 = "12345";
       }

    The access modifier of the event must be protected . Otherwise it is not visible from the .aspx page.

    Please let me know if this was helpful.

    Sincerely yours,
    Veronica Milcheva
    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.
  5. Daniel
    Daniel avatar
    3 posts
    Member since:
    Jan 2013

    Posted 17 Jan 2013 Link to this post

    (I realize this thread is very old, and generally don't resurect threads, but I'm searching for a solution to this as well)

    The article on telerik.com declares the event handler method as private, though...
  6. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 22 Jan 2013 Link to this post

    Hello Daniel,

    Your observations are absolutely correct and I would like to thank you for the remark. We will update our documentation to avoid any further confusions.

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