hi
I have 3 table in database
1-state
2-City
Id
|
name
|
state
|
1
|
Canada
|
USA
|
2
|
London
|
UK
|
3-Region
Id
|
regionname
|
cityid
|
1
|
01
|
Canada
|
2
|
02
|
London
|
and I have 3 DropDownList that refer below thread
http://www.aspforums.net/Threads/186961/replace-update-panel-control-with-other-code/
I use cascadingdropdown for these 3 dropdownlist below are codes:
<asp:DropDownList ID="DDLstate" runat="server" CssClass="ddlE">
</asp:DropDownList>
<cc1:CascadingDropDown ID="CascadingDropDown3" TargetControlID="DDLstate" PromptText="همه"
PromptValue="" ServicePath="../ServiceCS.asmx" ServiceMethod="GetCountries" runat="server"
Category="state" />
<asp:DropDownList ID="DDLcity" runat="server" CssClass="ddlE">
</asp:DropDownList>
<cc1:CascadingDropDown ID="CascadingDropDown2" TargetControlID="DDLcity" PromptText="همه"
PromptValue="" ServicePath="../ServiceCS.asmx" ServiceMethod="GetCities" runat="server"
Category="City" ParentControlID="DDLstate" />
<asp:DropDownList ID="ddlregion" runat="server" CssClass="DDlzoneM">
</asp:DropDownList>
<cc1:CascadingDropDown ID="CascadingDropDown1" TargetControlID="ddlregion" PromptText="همه"
PromptValue="" ServicePath="../ServiceCS.asmx" ServiceMethod="GetRegion" runat="server"
Category="Region" ParentControlID="DDLcity" />
AND
[WebMethod]
public CascadingDropDownNameValue[] GetCountries(string knownCategoryValues)
{
string query = "SELECT state FROM stateTest";
List countries = GetData(query);
return countries.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetCities(string knownCategoryValues)
{
string state = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)["state"];
string query = string.Format("SELECT Name FROM City WHERE state = N'{0}'", state);
List cities = GetData(query);
return cities.ToArray();
}
public CascadingDropDownNameValue[] GetRegion(string knownCategoryValues)
{
string city = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)["region"];
string query = string.Format("SELECT Regionname FROM region WHERE CityId = N'{0}'",city);
List region = GetData(query);
return region.ToArray();
}
1-DDLstate
2-DDLcity
3-DDLregion
at first I should select Item from DDLsate then DDlcity and at the end I should select Item from DDLregion
above code work correctly for ddlstate and ddlcity but it doesn't work for ddlregion...
I mean when I select Item from ddlcity in ddlregion shows:[Metod error500]
how I can solve this proble?
Best Regards
Neda