我可以一個屬性在單選按鈕列表項,像這樣添加到項目:添加「點擊」屬性ASP.NET下拉列表項
PaymentMethodDropDownList.Items[0].Attributes.Add("onclick", "javascript:showNoMethods();");
PaymentMethodDropDownList.Items[1].Attributes.Add("onclick", "javascript:showCreditCardMethod();");
PaymentMethodDropDownList.Items[2].Attributes.Add("onclick", "javascript:showSendPaymentMethod();");
然而,當我嘗試將屬性添加到DropDownList控件沒有關係似乎沒有用。我希望它是相似的。
我改變了「onclick」爲「onchange」,它仍然無法正常工作。 – 2009-05-04 18:44:42
它不應該附加到項目,而是附加到列表本身。 – 2009-05-04 18:45:47