我有這樣的代碼:懸停時無法獲得文字以加下劃線?
e.Row.Attributes["onmouseover"] = "this.style.textDecoration='underline';";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='';";
這應該這樣,當我將鼠標懸停在一排,在它的所有文本將帶有下劃線。但它不起作用。我也試過這個:
e.Row.Attributes.Add("onmouseover", "this.style.textDecoration='underline'");
哪一個也不行。
編輯:此代碼有效。是否有替代style.textDecoration類似於我可以使用,這不需要CSS?
e.Row.Attributes["onmouseover"] = "this.style.fontWeight='bold';";
這也不起作用。 – rustbird