




已阅读5页,还剩19页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Web LibraryEdit What is the Web Library?The NetTiers Web Library is a set of Controls and Objects that provide powerful tools to make your web development projects with NetTiers much easier and more efficient.Edit Typed DataSource Controls -vs- EntityDataSourceThe Web Library offers both Strongly Typed DataSource Controls as well as the more generic EntityDataSource.The strongly typed DataSource controls are great because by binding to them you have all your objects properties and methods pre-defined and at your disposal. All of this shows up in IntelliSense. These maintain the ObjectDataSource controls event model, except they are geared to your data, relationships, and domain.On the other hand, the EntityDataSource control is a generic datasource and is useful because it uses 100% reflection to work with the data providers. This is great when you need to change the type at runtime, or maybe you have written your own methods within the DataAccessLayer that you would like to call, then you would simply use the EntityDataSource control. Edit User Interface controlsThe Web Library adds a collection of user interface controls to your toolbox such as the strongly bound repeaters, EntityGridView, EntityDropDownList (and bound field version), BoundRadioButtonField, HyperlinkField, EntityLabel and a GridViewSearchPanel.Edit Web.Config ConfigurationTo use the NetTiers Web Library youll need to setup your web.config. 1 2 3 4 5 6 7 8 9 10 11 18 20 21 22Edit Using the Typed DataSource ControlsStrongly Typed DataSource controls: You will find that just by typing IntellisenseProductivity Enabler When you select the SelectMethod Attribute, you will see via intellisense a list of all available methods from your domain. How cool is that! IntellisenseSimple WebForm Example: Heres an example of a simple webform in its minimilist form, that would display a grid of all Employees with Auto-Generated columns. Web FormDesign View: Taking the form and selecting only the columns that I want, we create a nice grid. Design ViewEdit Data View Results:Heres the result of of the form. The wonderful part of the Typed DataSource control is that you dont have to do anything when you want to edit/insert/delete an object. You simply have the grid call the Edit/Delete/Insert command, which can be done a variety of ways in ASP.net 2.0.Design View ResultsEditAfter EditEdit TypedDataSource w/ Microsoft AJAX ExampleGridView Paging, Sorting and inline Update/DeleteAfter EditEdit Creating the GridFirst, create a new page and add the following GridView control: NOTE: Its very important that you specify the DataKeyNames property of the Gridview, otherwise, Insert/Update/Delete will not work. 1 5 6 7 8 10 11 13 14 15 17 18 19 20212223Next, add the CustomersDataSource control to your page: 24This is the tough part, so strap it in!252627Umm. Thats it! And you should have a functional GridView with paging and sorting!Using Microsoft AJAX: Now here comes the fun part, AJAXifying (see dictionary) your grid. As you know Microsoft released an extremely useful AJAX library called Micrsoft AJAX. Additionally, Microsoft created a toolkit filled with all sorts of useful AJAX tools called the AJAX Toolkit and released it to the community as open source. More information can be found: Edit Demonstrating Microsoft AJAX with .netTiersNow we want to add a filter to our page to demonstrate a new feature to NetTiers: 1 2 3 4 6 7 8 9 All10 Brazil11 Canada12 France13 Germany14 Italy15 Mexico16 Spain17 UK18 USA19 Venezuela20 21 22 23 24 25 2627Next, change the data source control above to add a parameter for the whereClause parameter of the GetPaged method. The SqlParameter allows you to define external filter controls that will be combined to generate the filter expression: 1 3 4 5 6 7 8 9 10AJAX Magic: Now we can add the magic! Make sure you have a reference to the AJAX Script Manager:1We want to wrap the GridView control with an UpdatePanel: 1 2 3 4 5 6 7 8 9 10Notice that the trigger is tied to the CountryList control so that the GridView is updated every time the selected country is changed. Poof! All Done.Edit Using the EntityDataSource ControlThe EntityDataSource controls is useful because it uses 100% reflection to work with the data providers. This is great when you need to change the type at runtime, or maybe you have written your own methods within the DataAccessLayer that you would like to call. You would simply use the EntityDataSource control. 129 30 31 ProviderName (required) - an alias for TypeProperty; the name of the static property of the DataRepository class which returns a reference to the specific provider instance.ex: ProviderName=CustomersProvider for Northwind.Data.DataRepository.CustomersProvider EntityTypeName (required) - the fully qualified class name of the entity class that is handled by the specified data provider. EntityKeyName - the name of the property that holds the primary key value. EntityKeyTypeName - the fully qualified class name for the return type of the EntityKeyName property. EnableTransaction - set to True if the EntityDataSource should rely on the EntityTransactionModule class to supply a TransactionManager object. InsertDateTimeNames - a comma-separated list of DateTime property names to initialize to the current DateTime.Now value during an insert operation. UpdateDateTimeNames - a comma-separated list of DateTime property names to initialize to the current DateTime.Now value during an update operation. Filter - the value to apply to the ListBase.Filter property after a select operation (only if EnablePaging is false) Sort - the value of the parameter to pass to the ListBase.Sort(string) method after a select operation (only if EnableSorting is false)Example: This is an example of populating a DropDownList control with data retrieved using the EntityDataSource control. 1 2 3asp:DropDownList ID=ShipViaList runat=server 4 SelectedValue= 5 AppendDataBoundItems=True 6 DataSourceID=ShippersDataSource 7 DataTextField=CompanyName 8 DataValueField=ShipperID 910 11 121314 Using Many To Many Relationship Controls The ManyToManyListRelationship control manages the junction table that links your primary entity with a foreign key table. Please see highlighted code below. 1 2 3 4 5 Cust #: 6 asp:Label ID=CustomerIDLabel runat=server Text= / 7 8 9 Company Name:10 asp:TextBox ID=CompanyNameTextBox runat=server Text= /11 12 13 Demographics:14 15 16 21 22 23 30 31 32 38 39 40 41 42 43 49 50 51 55 56 61 62 67 68 69 70 71 72 73 74 75 76 7778798087 88 89 90 Relationship ViewsEdit The EntityDropDownList and associated BoundEntityDropDownFieldEntityDropDownList - Derives from a DropDownList, but adds a few extra features such as the ability to add a
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年电视台主持人口试指南预测试题及答案解读
- 电仪安全基础知识培训
- 2025年仓库安全员必-备知识面试模拟题及答案
- 赫初可颜眼部护理误区
- 制作风筝教学课件
- 信息化交流教学课件
- 田径安全知识培训内容课件
- 单词教学主题课件下载
- 贵州省毕节市2024-2025学年高二下学期期末考试化学试题(含答案)
- 新解读《GB-T 18916.37 - 2018取水定额 第37部分:湿法磷酸》
- 联想超融合云数据中心解决方案
- 精选同济大学实验室安全教育考试题库(全)
- 项目部安全管理组织机构网络图GDAQ20102
- 卫生部《病历书写基本规范》解读(73页)
- 南方332全站仪简易使用手册
- 分汽缸安装施工方案1
- 高低压配电安装工程-技术标部分(共41页)
- 开业筹备(西餐厅采购物品)
- 日产700吨平板玻璃电助熔窑炉设计本科毕业论文
- 光缆熔接光纤熔接
- 受限空间作业票
评论
0/150
提交评论