Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Page Methods not getting invoked
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Page Methods not getting invoked

Feed from this thread
  • cutie pie avatar

    Posted on Mar 28, 2011 (permalink)

  • Hi All,

    I have defined a Shared Function in the code behind and a javascript function to call the webmethod. Also, I have EnablePageMethogs set to true in ScriptManager.

    However, nothing seems to be working.


    Below is the code behind and javascript code used.


  • Code Behind:-

    [System.Web.Services.WebMethod()]
        public static ArrayList getSubCategoriesByCategoryID(int categoryID)
        {

            SqlConnection test = new SqlConnection(ConfigurationManager.ConnectionStrings["test"].ConnectionString);
          
            ArrayList subCategories = new ArrayList();

            try
            {
                string description;
                if (conn.State == ConnectionState.Closed)
                {
                    test.Open();
                }
                SqlCommand getSubCategories = new SqlCommand();
                getSubCategories.CommandType = CommandType.StoredProcedure;
                getSubCategories.CommandText = "dbo.test_proc";
                getSubCategories.Parameters.Add("@categoryid", SqlDbType.VarChar,12).Value = categoryID;
                getSubCategories.Connection = test;

                SqlDataReader dr = getSubCategories.ExecuteReader();

                if (dr.HasRows)
                {

                    while (dr.Read())
                    {

                        description =   (string)dr.GetValue(0);
                        subCategories.Add(description);
                                       
                     }
                }
            
            }
         
            catch (Exception ex)
            {
                ex.ToString();
            }

            return subCategories;
            // Return toReturn
        }

     

    and Javascript:-

     function getSubCategory(sender, args) {
            var categoryID = sender.get_value();

            PageMethods.getSubCategoriesByCategoryID(categoryID, CallSuccess);
     

        }

     

    Thanks



  • Any Suggestions?

    Thanks

  • cutie pie avatar

    Posted on Mar 28, 2011 (permalink)

    Its a telerik website am creating. Do I need to add anything on Web.Config file for page methods to work. 
    Any Suggestions?

    Thanks

  • cutie pie avatar

    Posted on Mar 28, 2011 (permalink)

    I have fixed the issue. thanks

  • Back to Top

    Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Page Methods not getting invoked