去评论
推扬网

李献计:关于JS中Attributes.Add

admin
2020/08/12 17:25:19

红牛电脑的回答:

foreach (Control var in Page.Controls) { if (var is Button) { string btnId = Page.ClientID; if (Regex.IsMatch(btnId, @"^btn\d+$", RegexOptions.IgnoreCase)) { (var as Button).Attributes.Add("onclick", "xxx"); } } }

红牛电脑的回答:

foreach (Control var in Page.Controls) { if (var is Button) { string btnId = Page.ClientID; if (Regex.IsMatch(btnId, @"^btn\d+$", RegexOptions.IgnoreCase)) { (var as Button).Attributes.Add("onclick", "xxx"); } } }