转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 站长学院 >> Web开发 >> 正文
ASP.NET 从Beta1 升级到 Beta2 的新变化         ★★★★

ASP.NET 从Beta1 升级到 Beta2 的新变化

作者:闵涛 文章来源:闵涛的学习笔记 点击数:3425 更新时间:2009/4/23 10:48:41

ASP.NET 从Beta1 升级到 Beta2 的新变化

         In config.web “debugmode” has been renamed to “debug”.

         RegisterPostBackScript() has been removed from Control. You no longer need to call RegisterPostBackScript() if you are using GetPostBackEventReference(). Calls to RegisterPostBackScript() should be removed from code.

         Regex options have been modified to use an enumeration instead of string values. For cross-.net framework consistency, regular expressions options should be an enumeration type, rather than a string value. The enumeration is in System.Text.RegularExpressions.RegexOptions. The string constructor has been marked as deprecated. This constructor has been retained since the JScript compiler relies on it. The mapping of strings to enumerated types is as follows.

String RegexOptions Enum "" None c Compiled d Debug (emits console text in debug builds) i IgnoreCase m Multiline n ExplicitCapture r RightToLeft s Singleline x IgnorePatternWhitespace

The following examples show the differences between the old and new forms.

// use a case-insensitive regex (old form)

Regex r = new Regex("mypatt", "i")

// use a case-insensitive regex (new form)

Regex r = new Regex("mypatt", RegexOptions.IgnoreCase)

// use a compiled regex, case-insensitive regex (old form)

Regex r = new Regex("mypatt", "ic")

// use a compiled regex, case-insensitive regex (new form)

Regex r = new Regex("mypatt", RegexOptions.IgnoreCase|RegexOptions.Compiled)

         The ASP.NET persistence format was changed. The name of the property becomes the tag name, and the attributes that were on the (redundant) child tag move to the tag itself. For collections and templates the property name becomes the tag name.

         The IDesignerAccessor interface has been deleted; any design-time functionality a control offers should be implemented in the associated designer.

         The IParserAccessor interface is now privately implemented. Only the parser should have been calling AddParsedSubObject(). If you override AddParsedSubObject() in your control, the access level has changed to protected.

         The IAttributeAccessor interface is also privately implemented.

Old Code:

Control.GetAttribute("Attrib")     
Control.SetAttribute("Attrib", "Value")

New Code:

Control.Attributes["Attrib"] = Value

         Changes were made in the ASP.NET Control designer framework. All public methods and properties using IHTMLElement and other trident interfaces are no longer public. Control designers no longer implement IOleCommandTarget. The Web forms designer handles IOleCommandTarget internally. Designers return a collection of DesignerVerb objects. The behavior implementations DHTMLBehavior and IdentityBehavior cannot be accessed directly. Use the IHtmlControlDesignerBehavior and IUserControlDesignerBehavior interfaces to access them from your designer.

Old form New form TemplatedControlDesigner::CanTemplateEdit CanEnterTemplateMode TemplatedControlDesigner::TemplateMode InTemplateMode HtmlControlDesigner::HTMLElement DesignTimeElement UserControlDesigner::ViewLinkRootElement DesignTimeElementView

         System.Web.UI.Web controls.Design.WebControlToolboxItem has been moved to System.Web.UI.Design.WebControlToolboxItem. This only affects you if you have metadata on your common language runtime controls that derive from Control directly (rather than from WebControl).

         The BubbleEvent() and InvokeBubbleEvent() methods on Control have been renamed to OnBubbleEvent() and RaiseBubbleEvent(), respectively.

         The paging semantics of the DataGrid control have changed. In Beta1, DataGrid paging worked such that the user''''s PageIndexChanged event handler was responsible for calling DataBind(), and the DataGrid would automatically update the CurrentPageIndex property of the DataGrid. This did not make the requirement to implement an event handler intuitive. Therefore, in Beta2, the DataGrid will not change the CurrentPageIndex automatically. In your event handler, you must determine whether it is appropriate to allow a change in the current page, update the CurrentPageIndex property, and call DataBind(). DataGridPageChangedEventArgs no longer has an OldPageIndex property, since this is same as the CurrentPageIndex property on the control itself.  

Old Code:

private void DataGrid_PageIndexChanged(object sender, DataGridPageChangedEventArgs e) {
((DataGrid)sender).DataSource = {your data source};
((DataGrid)sender).DataBind();
}

New Code:

private void DataGrid_PageIndexChanged(object sender, DataGridPageChangedEventArgs e) {
((DataGrid)sender).DataSource = {your data source};
((DataGrid)sender).CurrentPageIndex = e.NewPageIndex;
((DataGrid)sender).DataBind();
}

 As a result of this change, you can now prevent changes in the page index simply by not doing anything in your event handler.

         The DataBindings property and HasDataBindings() method on Control have moved into IDataBindingsAccessor. These properties should not exist on the public interface of a Control, since they are intended for use by the designer only. They are now part of IdataBindingsAccessor, which is implemented privately on Control. HtmlControlDesigner now has a DataBindings public property which control designers can use as well.  

Old Code:

Control c;
DataBindinGCollection bindings = c.DataBindings;

New Code:

Control c;
DataBindinGCollection bindings = ((IDataBindingsAccessor)c).DataBindings;

With a control designer, this.DataBindings will return the data-binding collection of the control associated with the designer.

         A DataMember property was added to data-bound controls. This is an addition of new functionality, instead of a breaking change. The DataSource property for HtmlSelect, ListBox, DropDownList, CheckBoxList, RadioButtonList, Repeater, DataList and DataGrid has been changed to an object (see notes that follow), so as to allow both IEnumerable and DataSet instances to be used as a data source. All of these controls now have a string DataMember property that is used when the DataSource property is assigned a DataSet.

Rules for resolving the DataSource:

1)If the data source is a DataSet:

a)If the DataMember property is specified, use it to determine which DataTable within the DataSet is to be used.

b)If the DataMember property is not specified, use the DataTable with index 0.

2)If the data source is not a DataSet:

a)Use the DataSource directly. 

         The DataGrid no longer has a PageCount property. The presence of a PageCount property implies the presence of a DataSource instance at all times, but this is not the case. The only time a DataSource exists is within a call to DataBind(). It is useful only when you create a Pager item; in that case a PagedDataSource is passed in, from which the page count is available. 

Old Code:

dataGrid.DataSource = myDataSet.Tables["Table1"].DefaultView;

New Code:

dataGrid.DataSource = myDataSet;
dataGrid.DataMember = "Table1";

DataSource is now of type Object so as to support both IEnumerable and DataSet instances as data sources. This will eventually be changed back to IEnumerable, once DataSet implements it.

         The signature of IConfigSectionHandler has changed. Support for ConfigXmlInput has been replaced with support for System.Xml.XmlReader instead.

         State has been renamed to ViewState in the Control framework. The following have changed.

 
Old form New form MaintainState EnableViewState State ViewState LoadState LoadViewState LoadStateRecursive LoadViewStateRecursive SaveState SaveViewState SaveStateRecursive SaveViewStateRecursive IStateManager::Mark -> TrackState Control::Mark -> TrackViewState ControlState enum: StateLoaded ViewSta

[1] [2] [3] [4] [5] [6] [7]  下一页


[Delphi程序]升级到Delphi 6 - 兼容性问题(中文全文)  [Delphi程序]升级到Delphi 6 - 兼容性问题之三(完)
[Delphi程序]升级到Delphi 6 - 兼容性问题之二  [Delphi程序]升级到Delphi 6 - 兼容性问题之一
[Web开发]彻底放弃IIS让Apache也支持ASP.NET  [Web开发]ASP.NET 2.0发送电子邮件中存在的问题
[Web开发]ASP.NET 2.0移动开发之属性重写和模板化  [Web开发]ASP.NET 2.0中实现模板中的数据绑定
[Web开发]ASP.NET 母版页概述  [Web开发]ASP.NET 2.0 ObjectDataSource控件
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Web开发  · 网页制作
    · 平面设计  · 网站运营
    · 网站推广  · 搜索优化
    · 建站心得  · 站长故事
    · 互联动态
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台