Blogger Information
Blog 110
fans 0
comment 0
visits 112306
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
asp.net的几点汇总
Coco
Original
362 people have browsed it

  日期格式的显示

  <%#Eval("swmlsj", "{0:yyyy-MM-dd}")%>

  货币格式显示

  swmlsj.Text=Convert.ToDateTime(dt.Rows[0]["swmlsj"]).ToString("yyyy-MM-dd"); //日期格式

  xzjsd.Text=dt.Rows[0]["xzjsd"].ToString();

  xzjje.Text=Convert.ToDecimal(dt.Rows[0]["xzjje"]).ToString("C"); //货币格式

  表格数据汇总

  //求和

  Decimal jg=0;

  for (int i=0; i < dt.Rows.Count; i++)

  {

  jg +=Convert.ToDecimal(dt.Rows[i][8]); //注意哪个列

  }

  aaa=jg.ToString("C") + ";
大写:" + Common.Tools.CmycurD(jg).ToString();

  时间控件

  死亡冒领时间:

  文本框失去焦点检测

  身份证号码:

  链接传递多个参数

  追缴进度

  异步操作JS

  

  序号自增

  <%# Container.ItemIndex + 1%>

  CSS样式

  

  非空判断

  if (!string.IsNullOrEmpty(xzjsd.Text))

  {

  model.xzjsd=xzjsd.Text.Trim();

  }

  转换为大写字母

  model.sfzh=sfzh.Text.Trim().ToUpper(); // 转大写

  获取下拉列表的值

  model.xz=xz.Value; //下拉列表

  类型转换

  int id=int.Parse(context.Request.QueryString["delid"]);

  导出XLS

  //导出游戏账号购买全部数据

  protected void export_Click(object sender, EventArgs e)

  {

  DataTable dt=new DAL.shbt_ry().GetAllList();

  MemoryStream ms=DataTableRenderToExcel.DataTableToExcel(dt, "请核对导出数据");

  Response.AddHeader("Content-Disposition", string.Format("attachment; filename=" + DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss_fff") + ".xls"));

  Response.BinaryWrite(ms.ToArray());

  Response.ContentType="application/ms-excel";

  ms.Close();

  ms.Dispose();

  }

  清空

  this.RepList1.Controls.Clear();//清空当前内容

  RepList1.DataSource=string.Empty;

  RepList1.DataBind();

  显示PDF

  string url=Request.QueryString["url"];

  Response.ContentType="application/pdf";

  Response.Clear();

  Response.TransmitFile(url);

  Response.End();

  下载文件

  string fileURL=HttpContext.Current.Server.MapPath("~") + url;

  FileInfo fileInfo=new FileInfo(fileURL);

  Response.Clear();

  Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(fileInfo.Name.ToString()));

  Response.AddHeader("content-length", fileInfo.Length.ToString());

  Response.ContentType="application/octet-stream";

  Response.ContentEncoding=System.Text.Encoding.Default;

  Response.WriteFile(fileURL);

  打印JS代码

  

  

  页面边距CSS

  @page { margin-top:30px; margin-bottom:20px;}

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post