打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
asp.net编程中6条实用语句
1.Panel 横向滚动,纵向自动扩展 
<asp:panel style="overflow-x:scroll;overflow-y:auto;"></asp:panel> 
2.回车转换成Tab 
(1) 
<script language="javascript" for="document" event="onkeydown"> 
  if(event.keyCode==13 && event.srcElement.type!=’button’ && event.srcElement.type!=’submit’ &&     event.srcElement.type!=’reset’ && event.srcElement.type!=’’&& event.srcElement.type!=’textarea’); 
  event.keyCode=9; 
</script> 
(2)  //当在有keydown事件的控件上敲回车时,变为tab 
public void Tab(System.Web .UI.WebControls .WebControl webcontrol) 

webcontrol.Attributes .Add ("onkeydown", "if(event.keyCode==13) event.keyCode=9"); 
3.DataGrid超级连接列 
DataNavigateUrlField="字段名" DataNavigateUrlFormatString="http://xx/inc/delete.aspx?ID={0}" 
4.自定义异常处理 
//自定义异常处理类 
using System; 
using System.Diagnostics; 
namespace MyAppException 

  /// <summary> 
  /// 从系统异常类ApplicationException继承的应用程序异常处理类。 
  /// 自动将异常内容记录到Windows NT/2000的应用程序日志 
  /// </summary> 
  public class AppException:System.ApplicationException 
  { 
  public AppException() 
  { 
  if (ApplicationConfiguration.EventLogEnabled)LogEvent("出现一个未知错误。"); 
  } 
  public AppException(string message) 
  { 
  LogEvent(message); 
  } 
  public AppException(string message,Exception innerException) 
  { 
  LogEvent(message); 
  if (innerException != null) 
  { 
  LogEvent(innerException.Message); 
  } 
  } 
  //日志记录类 
  using System; 
  using System.Configuration; 
  using System.Diagnostics; 
  using System.IO; 
  using System.Text; 
  using System.Threading; 
  namespace MyEventLog 
  { 
  /// <summary> 
  /// 事件日志记录类,提供事件日志记录支持 
  /// <remarks> 
  /// 定义了4个日志记录方法 (error, warning, info, trace) 
  /// </remarks> 
  /// </summary> 
  public class ApplicationLog 
  { 
  /// <summary> 
  /// 将错误信息记录到Win2000/NT事件日志中 
  /// <param name="message">需要记录的文本信息</param> 
  /// </summary> 
  public static void WriteError(String message) 
  { 
  WriteLog(TraceLevel.Error, message); 
  } 
  /// <summary> 
  /// 将警告信息记录到Win2000/NT事件日志中 
  /// <param name="message">需要记录的文本信息</param> 
  /// </summary> 
  public static void WriteWarning(String message) 
  { 
  WriteLog(TraceLevel.Warning, message);   
  } 
  /// <summary> 
  /// 将提示信息记录到Win2000/NT事件日志中 
  /// <param name="message">需要记录的文本信息</param> 
  /// </summary> 
  public static void WriteInfo(String message) 
  { 
  WriteLog(TraceLevel.Info, message); 
  }
本文来自: 网页设计大本营(www.code-123.com) 详细出处参考:http://www.code-123.com/html/20081227123313580.html
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
马未都:人生最好的状态是什么呢?听完让我受益匪浅!
在网吧如何免费上网
汉中没什么好的
对手套很有信心
汉莎航空波音747-8宣传片
不用定义名称,解决if7层嵌套限制
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服