why need Static web method in Autocomplete box using web service

2 posts, 0 answers
  1. Heera
    Heera avatar
    11 posts
    Member since:
    Dec 2011

    Posted 17 Jan 2013 Link to this post

    Aspx page(Test.aspx)

     <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true">

    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" Width="250" DropDownHeight="150"
                    <WebServiceSettings Method="GetCompanyNames" Path="Test.aspx" />


            public static AutoCompleteBoxData GetCompanyNames(object context)

     string searchString = ((Dictionary<string, object>)context)["Text"].ToString();
                //DataTable data = GetChildNodes(searchString);
                DataTable data = new DataTable();

    SqlConnection conn = new SqlConnection(connectionstring);
                string sql = "SELECT ID,NAME  FROM T_Patient WHERE NAME LIKE '" + searchString + "%'";
                SqlDataAdapter da = new SqlDataAdapter(sql, conn);

                List<AutoCompleteBoxItemData> result = new List<AutoCompleteBoxItemData>();

                foreach (DataRow row in data.Rows)
                    AutoCompleteBoxItemData childNode = new AutoCompleteBoxItemData();
                    childNode.Text = row["NAME"].ToString();
                    childNode.Value = row["ID"].ToString();

                AutoCompleteBoxData res = new AutoCompleteBoxData();
                res.Items = result.ToArray();

                return res;

    Some Error is occured when public static AutoCompleteBoxData GetCompanyNames(object context) replace to public AutoCompleteBoxData GetCompanyNames(object context) [remove static keywords]

    i am not use public web method or any other idea use only public method /public static method.

    THE SERVER METHOD  'GetCompanyNames
    '  FAILED.

    please give me solution.

    thank you.

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 20 Jan 2013 Link to this post


    We have to use Static web method. Because this is the functionality from the .net.


    Jayesh Goyani
Back to Top