温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:明博静态新闻文章发布系统源码
当前文件:
MinbelNews/Files/ShowFileList.aspx.cs,打开代码结构图
MinbelNews/Files/ShowFileList.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
//该源码下载自www.51aspx.com(51aspx.com) 12
13
//此文件使用方式是 ?TypeID=2 14
public partial class Files_ShowFileList : System.Web.UI.Page 15
{ 16
public string strTypeID = ""; 17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
20
if (Request.QueryString["TypeID"] != null) 21
{ 22
23
strTypeID = Request.QueryString["TypeID"].ToString(); 24
} 25
else 26
{ 27
Response.Write(@"<script language='javascript'>alert('参数不能为空!');</script>"); 28
return; 29
} 30
31
if (!Page.IsPostBack) 32
{ 33
if (strTypeID != "") 34
{ 35
string strSQL = "SELECT [Title], [Url], [TypeID], [Limit], [InputTime] FROM [FileList] WHERE ([TypeID] =" + Int32.Parse(strTypeID) + ") ORDER BY [InputTime] DESC"; 36
FileSDS.SelectCommand = strSQL; 37
gvFile.DataSourceID = FileSDS.ID; 38
} 39
else 40
{ 41
Response.Write(@"<script language='javascript'>alert('参数不能为空!');</script>"); 42
return; 43
} 44
} 45
46
} 47
protected void gvFile_RowDataBound(object sender, GridViewRowEventArgs e) 48
{ 49
//隐藏列 50
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header) 51
{ 52
e.Row.Cells[1].Visible = false;//typeid 53
e.Row.Cells[2].Visible = false;//url 54
55
} 56
if (e.Row.RowType == DataControlRowType.DataRow) 57
{ 58
//我们先设置当鼠标上去的时候他的背景色改变 59
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F3F8F8'"); 60
//下面我们再设置当鼠标离开后背景色再还原 61
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;"); 62
} 63
} 64
65
} 66
67
68
69





}
}