// 这里是主表输出是 自定义表格格式函数 private bool bSwitch = false; string color1 = "#ffffcc"; string color2 = "#ccff99"; /// <summary> /// 定义搜索后列表 主表样式输出 /// </summary> /// <param name="con"></param> /// <returns></returns> public string TRJavaScript(Control con) { string tmp; DataListItem dli = con as DataListItem; Button btn = dli.FindControl("HiddenButton") as Button; string _js = "bgcolor={0} onMouseover='rowcolor=this" + ".style.backgroundColor;this.style.backgroundColor" + "=\"#00FF28\"; this.style.cursor = \"hand\"' " + "onMouseout='this.style.backgroundColor=rowcolor;' " + " οnclick='document.getElementById(\"{1}\").click();' "; tmp = bSwitch ? string.Format(_js, color1, btn.ClientID) : string.Format(_js, color2, btn.ClientID); bSwitch = !bSwitch; return tmp; }