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

RadComboBox4_SelectedIndexChanged is not working

4 Answers 144 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rita15
Top achievements
Rank 1
Rita15 asked on 25 Feb 2010, 04:20 PM

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

4 Answers, 1 is accepted

Sort by
0
Accepted
robertw102
Top achievements
Rank 1
answered on 26 Feb 2010, 02:22 PM
In your code-behind you have the event declared as private, but it should be declared as protected.

I hope that helps.
0
Accepted
Veronica
Telerik team
answered on 26 Feb 2010, 02:23 PM
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.
0
Daniel
Top achievements
Rank 1
answered on 17 Jan 2013, 03:51 PM
(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...
0
Boyan Dimitrov
Telerik team
answered on 22 Jan 2013, 10:42 AM
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.
Tags
ComboBox
Asked by
Rita15
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Veronica
Telerik team
Daniel
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or