摘要:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" AllowSorting="True" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRo... 阅读全文
摘要:
在GridView中显示的数据可能不是按照某种排列书序的,例如ID列,假如我们让它按照升序来进行排序,参照CSDN上清清月儿的写法,在RowDataBound中增加代码如下:if (e.Row.RowIndex != -1) { int id = e.Row.RowIndex + 1; e.Row.Cells[0].Text = id.ToString(); } 阅读全文
摘要:
只需要在RowDataBound中增加以下代码就可以简单实现 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { //判断当前行是否是数据行 if (e.Row.RowType == DataControlRowType.DataRow) { //正常状态和交互状态 if (e.Row.Row... 阅读全文
摘要:
阅读全文
摘要:
在GridView的事件中增加RowDataBound,在这个事件中首先判断当前行是不是数据行,然后进行变色处理,代码如下所示:if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标经过时,行背景色变 e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#CC00... 阅读全文