ajax cascading dropdown not working -
i using ajax toolkit 4.5. have use cascading dropdown in project. tried this-
<asp:dropdownlist id="dropdownlist1" runat="server" width="126px"></asp:dropdownlist> <asp:cascadingdropdown id="cascadingdropdown1" targetcontrolid="dropdownlist1" category="country" runat="server" usecontextkey="true" prompttext="select" servicemethod="getcountry" servicepath="~/ajaxservice.asmx" ></asp:cascadingdropdown>
and web service code is-
public cascadingdropdownnamevalue[] getcountry(string knowncategoryvalues, string category) { ajaxdatacontext db = new ajaxdatacontext(); var list = db.countries.select(con => new {con.country1,con.id }).distinct(); list<cascadingdropdownnamevalue> values = new list<cascadingdropdownnamevalue>(); foreach (var data in list) { values.add(new cascadingdropdownnamevalue((string)data.country1, data.id.tostring())); } return values.toarray(); }
but not working. no data showing on dropdown. please describe wrong doing. thank you.
Comments
Post a Comment