August 19, 2008 at 2:43 am
aspx form:
Category: <asp:DropDownList ID="ddlCategory"
runat="server" />
<ajaxToolkit:CascadingDropDown
ID="CascadingDropDown1"
runat="server"
TargetControlID="ddlCategory"
Category="category"
PromptText="Select a Category"
LoadingText="[Loading Category...]"
ServicePath="AutoComplete.asmx"
ServiceMethod="GetCategory" />
Webservice file:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{
[WebMethod]
[System.Web.Script.Services.ScriptMethod()]
public CascadingDropDownNameValue[] GetCategory(string knownCategoryValues, string category)
{
SqlConnection conn = new SqlConnection("server=localhost;database=blankphed;user id=sa;password=nicnet10");
conn.Open();
SqlCommand comm = new SqlCommand("SELECT categoryname,categoryid from ContractorCategory", conn);
SqlDataReader dr = comm.ExecuteReader();
List ();
try
{
while (dr.Read())
{
string name = (string)dr["categoryname"];
int id = (int)dr["categoryid"];
value.Add(new CascadingDropDownNameValue(name, id.ToString()));
}
}
catch { }
finally
{
conn.Close();
}
return value.ToArray();
}
}
When i run it ,it lead to a problem in the combobox method error 500 .What i have to do.
August 19, 2008 at 11:56 am
It does not seem to be a database server issue. Here is link. May it help.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply