J'essaie d'implémenter la liste déroulante en cascade de la boîte à outils. J'ai besoin d'obtenir le compte dans une liste déroulante de sous-catégorie, si c'est zéro puis j'éteins la visibilité de la sous-catégorie.Appel de Javascript après que la méthode Web ait été déclenchée
Si j'utilise l'événement javascript OnChange alors mon script se déclenche avant la méthode web, j'ai donc besoin de savoir comment déclencher mon script APRÈS que la méthode web ait été déclenchée.
Ma page de démonstration: http://bit.ly/92RYvq
Voici mon code et l'ordre que je besoin de tirer.
[WebMethod]
public CascadingDropDownNameValue[] GetSubCats1(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int CategoryID;
if (!kv.ContainsKey("Category") || !Int32.TryParse(kv["Category"], out CategoryID))
{
return null;
}
dsSubCat1TableAdapters.Categories_Sub1TableAdapter SubCats1Adapter = new dsSubCat1TableAdapters.Categories_Sub1TableAdapter();
dsSubCat1.Categories_Sub1DataTable SubCats1 = SubCats1Adapter.GetSubCats1(CategoryID);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in SubCats1)
{
values.Add(new CascadingDropDownNameValue((string)dr["SubCategory1"], dr["SubCatID1"].ToString()));
}
return values.ToArray();
}
longueur getSubCatCount fonction () {$ get ("ddlSubCats1"). Style.display = $ get ("ddlSubCats1").> 1? "block": "aucun"; }
Melt vous a répondu via le système de réponse en raison de sa réputation, tout comme un fyi. – Brian