随笔分类 -  随笔 .Net

asp.net 几种文件下载方式比较
摘要:/* * asp.net 几种文件下载方式比较 * * 方法1、HttpResponse.TransmitFile * 方法2、HttpResponse.WriteFile * 方法3、HttpResponse.BinaryWrite * 方法4、HttpResponse.Redirect * * 方法1与方法2 * 相同点:都是通过文件的相对或绝对路径下载文件; * 不同点:方法2是一次性将... 阅读全文
posted @ 2009-06-03 17:46 Good life 阅读(1255) 评论(0) 推荐(0)
关于standard button和html button之disabled属性的比较
摘要:一、测试代码:1、aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org... 阅读全文
posted @ 2009-02-19 11:38 Good life 阅读(982) 评论(0) 推荐(0)
为继承masterpage的页面设置defaultbutton和defaultfocus
摘要:一个普通的aspx页面,我们可以很容易地为其设置设置defaultbutton和defaultfocus,具体如下:.aspx:<form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button I... 阅读全文
posted @ 2008-10-23 10:05 Good life 阅读(632) 评论(2) 推荐(0)
StreamReader & StreamWriter
摘要:public void wirte() { try { StreamReader sr = new StreamReader("c:\\Variables.txt"); string content = sr.ReadToEnd(); sr.Close(); S... 阅读全文
posted @ 2008-08-06 21:16 Good life 阅读(287) 评论(0) 推荐(0)
一个简单的登录页面
摘要:signin.aspx: Sign In Simple Factory Pattern Demo UserName: ... 阅读全文
posted @ 2008-08-06 08:52 Good life 阅读(393) 评论(0) 推荐(0)
XML结合XSLT生成Excel(导入到多个Worksheet)
摘要:1、.aspx Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> Untitled Page 2、code-behide Code Code highlighti... 阅读全文
posted @ 2008-08-05 22:12 Good life 阅读(855) 评论(0) 推荐(0)
反转一句话(完全反转各字符)
摘要:目的:将字串"I am a programmer"完全反转为"remmargorp a ma I"。 方法一: private static void reverse() { string str = "I am a programmer"; for (int i = str.Length -1; ... 阅读全文
posted @ 2008-08-05 15:09 Good life 阅读(401) 评论(0) 推荐(0)
反转一句话(仅反转各单词的顺序)
摘要:一、目的:将字符串"I am a programmer" 反转为 "programmer a am I". 二、具体实现 方法1,使用split函数 思路:将str用一个空格分割成数组,然后将数组"从尾至头"输出;输出时有一个小问题需要注意,由于分割得到数组的过程去掉了原字符串中(数组长度数-1)个空格,所以输出时要补上。 private static void reverse()... 阅读全文
posted @ 2008-08-05 14:51 Good life 阅读(631) 评论(0) 推荐(0)
冒泡排序
摘要:其基本思想是: 将被排序的记录数组R[1..n]垂直排列,每个记录R看作是重量为R.key的气泡。根据轻气泡不能在重气泡之下的原则,从下往上扫描数组R:凡扫描到违反本原则的轻气泡,就使其向上"飘浮"。如此反复进行,直到最后任何两个气泡都是轻者在上,重者在下为止。 测试: using System; using System.Collections.Generic; using System.T... 阅读全文
posted @ 2008-08-05 08:54 Good life 阅读(452) 评论(0) 推荐(0)
Read and write flat file
摘要:private void operateFlatFile() { string path; FileStream fs; byte[] _read, _write; int start, end; start = 0; end = 50; // read path = Server.MapPath("http://www.cnb... 阅读全文
posted @ 2007-06-20 18:18 Good life 阅读(292) 评论(0) 推荐(0)