国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

解析asp.net編程中6條實用語句_.Net教程

2024-07-10 12:52:03
字體:
來源:轉載
供稿:網友

推薦:什么是.net的接口和抽象類
什么是接口? 接口是包含一組虛方法的抽象類型,其中每一種方法都有其名稱、參數和返回值。接口方法不能包含任何實現(xiàn),CLR允許接口可以包含事件、屬性、索引器、靜態(tài)方法、靜態(tài)字段、靜態(tài)構造函數以及常數。但是注意:C#中不能包含任何靜態(tài)成員。一個類可以實

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事件的控件上敲回車時,變?yōu)閠ab 

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> 
  /// 從系統(tǒng)異常類ApplicationException繼承的應用程序異常處理類。 
  /// 自動將異常內容記錄到Windows NT/2000的應用程序日志 
  /// </summary> 
  public class AppException:System.ApplicationException 
  { 
  public AppException() 
  { 
  if (ApplicationConfiguration.EventLogEnabled)LogEvent("出現(xiàn)一個未知錯誤。"); 
  } 
  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); 
  }

分享:10個ASP.NET編程技巧
1、盡量減少表單回送 每當點擊Web網頁上的Button、LinkButton或ImageButton控件時,表單就會被發(fā)送到服務器上。如果控件的AutoPostBack屬性被設置為true,如果CheckBox、CheckBoxList等控件的狀態(tài)被改變后,也會使表單會發(fā)送回服務器。 每次當表單被發(fā)送回服

共2頁上一頁12下一頁
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 花莲市| 马山县| 顺平县| 兴山县| 栾城县| 会宁县| 淳化县| 汾阳市| 肇州县| 普安县| 武宣县| 鄂伦春自治旗| 梁山县| 台湾省| 周口市| 武功县| 金阳县| 玉田县| 沧州市| 蓝山县| 台安县| 鄂州市| 集安市| 邯郸县| 弥渡县| 西宁市| 盖州市| 巴青县| 镶黄旗| 合肥市| 德江县| 织金县| 潜江市| 安宁市| 湖口县| 南华县| 南岸区| 思茅市| 原阳县| 东丽区| 涞源县|