gridView的数据源是个DataTable的实例,
gridView的第一列为linkbutton,
我的问题是,我需要根据不同的情况,使部分linkbutton没有超链接的下划线,而且文字还要是正常显示的。
我该怎么做呢?我要问的一个是:分情况判定的时候,除了遍历整个Dt之外有没有其他的方法?
另一个是:怎么把linkbutton的下划线去掉,还要正常显示文本?谢谢!

解决方案 »

  1.   


        #region 绑定行事件
        /// <summary>
        /// 绑定行事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex != -1)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#eef7fe'");                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
                }
                int id = e.Row.RowIndex + 1;
                e.Row.Cells[0].Text = id.ToString();            if (e.Row.Cells[5].Controls.Count != 0)
                {
                    ((LinkButton)e.Row.Cells[5].Controls[0]).Attributes.Add("onclick", "return confirm('确定删除此条纪录吗?')");
                }
                if (e.Row.Cells[4].Controls.Count > 1)
                {
                    ((LinkButton)e.Row.Cells[4].Controls[0]).Attributes.Add("onclick", "return confirm('确定更新此条纪录吗?')");
                }
            }
        }
        #endregion
    研究一下上面的代码自己该一下样式就可以了