摘要:
一直不喜欢用Gridview,可是任务说明要用Gridview的RowCommand事件,把代码整理如下:View Code 1 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) 2 { 3 if (e.CommandName == "Up") 4 { 5 string[] skey = e.CommandArgument.ToString().Split(','); 6 7 SqlConnection con = new SqlConnection( 阅读全文
摘要:
查msdn,截图如下:代码如下:View Code 1 if (this.FileUpload1.HasFile) 2 { 3 string filename = this.FileUpload1.FileName;//获得文件名 4 string fileExtension = Path.GetExtension(filename).ToUpper();//获得扩展名 5 string filenameforSave = DateTime.Now.ToFileTimeUtc().ToString() ; 6 double size = this.FileUpload1.PostedFile. 阅读全文
摘要:
View Code 1 string sFileName = Path.GetFileNameWithoutExtension(this.FileUpload1.FileName); 2 string sExtension = Path.GetExtension(FileUpload1.FileName); 3 double size = FileUpload1.PostedFile.ContentLength / 1024; 4 if (size < 60) 5 { 6 string fi = Server.MapPath(@"img/") + sFileName 阅读全文
摘要:
后台代码 1 protected void Page_Load(object sender, EventArgs e) 2 { 3 Bitmap bitmap = CreateBitmap(GetRandomDigit(2)+GetRandomNumbers(2)); 4 bitmap.Save(Response.OutputStream, ImageFormat.Jpeg); 5 bitmap.Dispose(); 6 } 7 #region 数字验证 8 public string GetRandomDigit(int len) 9 {10 string str = "12345 阅读全文
摘要:
http://logging.apache.org/log4net/配置如下:在<configSections>节点配置如下: <configSections> <section name ="log4net" type="System.Configuration.IgnoreSectionHandler"/> </configSections>另外,还要在顶级节点<configuration>下增加<log4net>子节点;在<log4net>节点下增加<appe 阅读全文
摘要:
本文介绍AspNetPager控件做数据的分页;AspNetPager是第三方控件,下载地址:http://www.webdiyer.com/AspNetPagerDocs/index.html。然后通过Visaul Studio 2005的“选择项”把下载后的控件DLL加载到我们的控件工具箱中。 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:BoundField DataFi 阅读全文
摘要:
CurrentExecutionFilePath的解释上:获取当前请求的虚拟路径。见代码:后台 1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!IsPostBack) 4 { 5 databind(); 6 this.HyperLink1.Visible = true; 7 this.HyperLink4.Visible = true; 8 } 9 }10 public void databind()11 {12 SqlConnection con = new SqlConnection(@"Data 阅读全文
摘要:
public Bitmap CreateBitmap(){Response.ContentType="image/jpeg";Bitmap bitmap=new Bitmap(100,30);Graphics graphics =Graphics.FromImage(bitmap);Random random =new Random();for(int i =0;i<30;i++){int x1 = random.Next(100);int x2 =random.Next(100);int y1 =random.Next(30);int y2 = random.Nex 阅读全文
摘要:
看效果:如下:前台js:<script language="javascript" type="text/javascript"> var list = document.getElementsByName("ch"); window.onload =function() { for(var i=0;i<list.length;i++) { list[i].onclick=chkclick; } } function chkclick() { var listVar=""; for(var i=0 阅读全文
摘要:
先看图:这个功能可以用后台管理中(区域的绑定,商品大类,商品小类,商品信息的管理);实现原理如下:先建设一个数据表如:高校栏目表截图如下:ParentID保存父ID的节点,ChildID保存子ID的节点,如果某一行中的ParentID不为空,子节点为空,说明此行为父节点;而子节点的ParentID对应相应的父节点。前台代码 1 <div> 2 <asp:DataList ID="DataList1" runat="server" OnItemDataBound="DataList1_ItemDataBound" &g 阅读全文