易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.Net中用C#实现站点计数器用户控件

asax文件:
  <%@ Control Language="c#" AutoEventWireup="false" Codebehind="counter.ascx.cs" Inherits="JiAnWeb.counter" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
  <LINK href="css.css" rel="stylesheet">
  <FONT face="宋体">
  <TABLE id="table_counter" cellSpacing="0" cellPadding="0" width="750" align="center" border="0"
  runat="server">
  <TR>
  <TD style="HEIGHT: 23px" align="center" valign=middle><IMG height="1" alt="" src="pic\rightblueback.gif" width="700"></TD>
  </TR>
  <TR>
  <TD align=center valign=middle></TD>
  </TR>
  </TABLE>
  </FONT>
  -------------------
  .cs文件:
  namespace JiAnWeb
  {
  using System;
  using System.Data;
  using System.Drawing;
  using System.Web;
  using System.Web.UI.WebControls;
  using System.Web.UI.HtmlControls;
  
  /// <summary>
  /// counter 的摘要说明。
  /// </summary>
  public class counter : System.Web.UI.UserControl
  {
  protected System.Web.UI.HtmlControls.HtmlTable table_counter;
  
  private void Page_Load(object sender, System.EventArgs e)
  {
  // 在此处放置用户代码以初始化页面
  string filePath=System.Web.HttpContext.Current.Server.MapPath("hits.txt");
  System.IO.StreamReader srReadLine = new System.IO.StreamReader(
  System.IO.File.OpenRead(filePath),
  System.Text.Encoding.ASCII);//Encoding.Default是读中文
  srReadLine.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);//
  string countStr="";
  if (srReadLine.Peek() > -1)
  {
  countStr+=srReadLine.ReadLine();
  }
  int count=int.Parse(countStr)+1;
  countStr=count.ToString();
  srReadLine.Close();
  table_counter.Rows[1].Cells[0].InnerHtml="<font color=\"#009900\">";
  for (int i=0;i<countStr.Length;i++)
  {
  table_counter.Rows[1].Cells[0].InnerHtml=table_c


相关文档:

C#.Net操作XML文件的数据

XML文件作为数据数据存储介质的一种,好处在于:任何的系统均可以解析它。
XML全称:Extensible Markup Language(扩展标记语言)使用文档类型定义(DTD)或者模式(Schema)来描述数据的。可供人阅读,而且还基于一种公共的开发标准。
最近由于开发的需要,也是研究以下XML的操作,本篇日志主要总结C#.NET中是如何操作XM ......

C#实现XML系列化和反系列化的总结

常用的系列化定义(using System.Xml.Serialization;)
[XmlAttribute("name")]        // 定义<Tag name="…"></Tag>
[XmlElement("label")]        // 定义<label>…</label>
[XmlIgnoreAttrib ......

asp.net页面刷新后的滚动条位置不变

只需在asp.net页面的Page指令中设置MaintainScrollPositionOnPostback="true"就可以轻松实现。
MaintainScrollPositionOnPostback属性的默认值为false。
另外asp.net的page对象还有一个SmartNavigator属性,这个属性我也试过。。好像对于css有影响。页面布局有点变化。。不是很好使 ......

ASP.NET(C#)常用代码30例

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1 ......

ASP.NET MVC扩展库

很多同学都读过这篇文章吧 ASP.NET MVC中你必须知道的13个扩展点,今天给大家介绍一个ASP.NET MVC的扩展库,主要就是针对这些扩展点进行。这个项目的核心是IOC容器,包括Ninject, StructureMap, Unity ,Windsor和Autofac。如果你和我一样喜欢使用IOC,这个库值得你关注,这些IOC我都用过了,现在比较喜欢使用Autofac。
AS ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号