| Swaps 的个人资料Swaps Blog照片日志 | 帮助 |
|
6月30日 ASP.NET SQL Server Reg ToolASP.NET SQL Server Registration Tool Aspnet_regsql.exe The ASP.NET SQL Server Registration tool is used to create a Microsoft SQL Server database for use by the SQL Server providers in ASP.NET, or to add or remove options from an existing database. The Aspnet_regsql.exe file is located in the [drive:]\%windir%\Microsoft.NET\Framework\version folder on your Web server. You can run Aspnet_regsql.exe without any command-line arguments to run a wizard that will walk you through specifying connection information for your SQL Server installation, and installing or removing the database elements for the membership, role management, profile, Web Parts personalization, and health monitoring features. (Setting session state and SQL cache dependency are not covered by the wizard.) You can also run Aspnet_regsql.exe as a command-line tool to specify database elements for individual features to add or remove, using the options listed in the table below. Aspnet_regsql.exe <options>
Sql Connection Options -? Prints Aspnet_regsql.exe Help text in the command window. -W Runs the tool in wizard mode. This is the default if no command-line arguments are specified. -C <connection string> Specifies the connection string to the computer running SQL Server where the database will be installed, or is already installed. This option is not necessary if you specify only the server (-S) and login (-U and -P, or -E) information. -S <server> Specifies the name of the computer running SQL Server where the database will be installed, or is already installed. -U <login ID> The SQL Server user ID to log in with. This option also requires the password (-P) option. This option is not necessary if you are authenticating using Windows credentials (-E). -P <password> The SQL Server password to log in with. This option also requires the user ID (-U) option. This option is not necessary if you are authenticating using Windows credentials (-E). -E Authenticates using the Windows credentials of the currently logged-on user. -sqlexportlonly <filename> Generates a SQL script file that can be used to add or remove the specified features. The specified actions are not performed. SQL Cache DependencyAn advanced feature of ASP.NET output caching is SQL cache dependency. SQL cache dependency supports two different modes of operation: one that uses an ASP.NET implementation of table polling and a second mode that uses the query notification features of SQL Server 2005. Aspnet_regsql.exe can be used to configure the table-polling mode of operation. SQL cache dependency enables you to cache pages that are dependent on data from SQL Server tables. You can configure SQL Server and ASP.NET to cache page requests, reducing server workload, until the data on which the page depends has been updated in SQL Server. SQL cache dependency is useful for data such as product catalogs or customer registration information that remains comparatively static. Note that you must configure SQL Server to provide proper notification to ASP.NET about changes in dependent data when you use the ASP.NET table-polling mode of SQL cache dependency. Thus, you will need administrative privileges to configure the server. Session StateASP.NET session state is designed to enable you to easily store user session data in different sources for your ASP.NET applications. By default, session state values and information are stored in memory within the ASP.NET process. Alternatively, you can store session data in a SQL Server database, where it can be shared by multiple Web servers. If the database that you specify for session state with Aspnet_regsql.exe does not already exist, then the current user must have rights to create databases in SQL Server as well as to create schema elements within a database. If the database does exist, then the current user must have rights to create schema elements in the existing database. To install the session state database on SQL Server, run Aspnet_regsql.exe tool supply the following information with the command: · The name of the SQL Server instance, using the -S option. · The logon credentials for an account that has permission to create a database on a computer running SQL Server. Use the -E option to use the currently logged-on user, or use the -U option to specify a user ID along with the -P option to specify a password. · The -ssadd command-line option to add the session state database. By default, you cannot use Aspnet_regsql.exe to install the session state database on a computer running SQL Server 2005 Express Edition. Swapnil (swaps) 6月27日 Web Service Consuming ToolFolks,
There is a Usniversal Web Service Consuming tool Available which will help you in consuming the Web Services. Using this tool you can call the webservice by giving WSDL address and access to web methods and its response by giving appropriate parameters. This will also helps users in testing the Webservices request and response.
Click on below link to download the tool.
Swapnil (Swaps)
ASP.NET IIS Registration Tool (ASPnet_regiis.exe)ASP.NET IIS Registration Tool (Aspnet_regiis.exe)
When multiple versions of the .NET Framework are executing side-by-side on a single computer, the ASP.NET ISAPI version mapped to an ASP.NET application determines which version of the common language runtime (CLR) is used for the application. The ASP.NET IIS Registration Tool (Aspnet_regiis.exe) allows an administrator or installation program to easily update the script maps for an ASP.NET application to point to the ASP.NET ISAPI version that is associated with the tool. The tool can also be used to display the status of all installed versions of ASP. NET, register the ASP.NET version that is coupled with the tool, create client-script directories, and perform other configuration operations. aspnet_regiis [options]
Options -c Installs the client-side scripts for ASP.NET, such as client-side validation scripts, to the aspnet_client subdirectory of each Internet Information Services (IIS) site directory. Only the client-side scripts for the ASP.NET version that is associated with Aspnet_regiis.exe are installed. -disable Disables ASP.NET in the IIS Security Console.This option can be combined only with the -i, -ir, or -r options. It is not available with IIS versions earlier than IIS 6.0. -e Removes the client-side scripts for ASP.NET from the aspnet_client subdirectory of each IIS site directory. Only the client-side scripts for the ASP.NET version associated with Aspnet_regiis.exe are removed. -ea Removes the client-side scripts for all versions of ASP.NET from the aspnet_client subdirectory of each IIS site directory. -enable Enables ASP.NET in the IIS Security Console. This option can be combined only with the -i, -ir, or -r options. It is not available with IIS versions earlier than IIS 6.0 or with ASP.NET versions earlier than ASP.NET version 2.0. -ga user Grants the specified user or group access to the IIS metabase and other directories that are used by ASP.NET.This option is not available with ASP.NET versions earlier than ASP.NET 2.0. -I Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below. Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected. -ir Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and only registers ASP.NET in IIS. This option does not update the script maps. To install ASP.NET and update the script maps, use the -i option. -k path Removes the script maps to all versions of ASP.NET from all ASP.NET applications at the specified application root path and its subdirectories. -kn path Removes the script maps to all versions of ASP.NET from the ASP.NET application only at the specified application root path. This option does not affect applications in subdirectories of the specified path.
-lk Lists the path and version of all IIS metabase keys where ASP.NET is mapped. The keys that inherit ASP.NET script maps from a parent key are not displayed. -lv Lists the status and installation path of all versions of ASP.NET that are installed on the computer. -norestart Inhibits the restart of the World Wide Web Publishing Service after installing or updating ASP.NET script maps. If you do not use this option, all application pools are recycled. Use this option with the -i or -r options when the IIS worker process will be restarted manually. -r Updates all of the script maps in the IIS metabase and below to point to the ASP.NET ISAPI version that is associated with Aspnet_regiis.exe. All existing script maps are updated to point to the ASP.NET ISAPI version that is associated with the ASP.NET IIS Registration tool, regardless of the current version. -s path Installs the script map that points to the ASP.NET ISAPI version associated with Aspnet_regiis.exe to all ASP.NET applications at the specified application root path and its subdirectories. All existing script maps in the specified path and below that use an earlier version of the ASP.NET ISAPI are updated. -sn path Installs the script map that points to the ASP.NET ISAPI version associated with the tool to the ASP.NET application at the specified application root path. All existing script maps in the specified path that use an earlier version of the ASP.NET ISAPI are updated. This option does not affect applications in subdirectories of path. -u Uninstalls the version of ASP.NET that is associated with the ASP.NET IIS Registration tool from the computer. Existing script maps to this version of the ASP.NET ISAPI are automatically remapped to the most recent remaining ASP.NET ISAPI version installed. -ua Uninstalls all versions of ASP.NET from the computer. -? Displays the command syntax and options for the ASP.NET IIS Registration tool.
Swapnil (swaps) http://swapsnet.spaces.live.com/
6月25日 Compiling Multiple Projects Without SolutionCompiling Multiple Projects Without Solution
Automating your build process is very important. An automated build process can detect new issues in a timely manner which means there is a lot less code to have to look at to figure out why it broke. However, it can be time consuming to put together a build process and, if it's not automated enough, can become a source of bugs as well.
So what do you do if you have more projects in your application that can reasonably be put into a solution? How do you run your automated build? Wouldn't it be nice to be able to just point to a directory and compile all of the projects under it in the correct order based on the dependencies already defined in your projects? The source that is included with this article will do this! Just give it a root directory or text file and it will build an MSBuild project that you can use to compile your projects in the correct order. Check out this link to Download and Detailed information about the Article
Swapnil (swaps)
ASP.NET Browser Registration ToolASP.NET Browser Registration Tool (Aspnet_regbrowsers.exe) The ASP.NET Browser Registration tool parses and compiles all system-wide browser definitions into an assembly and installs the assembly into the global assembly cache. The tool uses the browser definition files (.BROWSER files) from the .NET Framework Browsers subdirectory. The tool can be found in the %SystemRoot%\Microsoft.NET\Framework\version\ directory. In ASP.NET version 1.1, the Machine.config file contained a section called <browserCaps>. This section contained a series of XML entries that defined the configurations for various browsers based on a regular expression. For ASP.NET version 2.0, a new .BROWSER file defines the parameters of a particular browser using XML entries. You add information on a new browser by adding a new .BROWSER file to the folder located at %SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers on your system. Because an application is not reading a .config file every time it requires browser information, you can create a new .BROWSER file and run Aspnet_regbrowsers.exe to add the required changes to the assembly. This allows the server to access the new browser information immediately so you do not have to shut down any of your applications to pick up the information. An application can access browser capabilities through the Browser property of the current HttpRequest. aspnet_regbrowsers.exe <options> Options -? Displays the Aspnet_regbbrowsers.exe Help text in the command window. -i Creates the runtime browser capabilities assembly and installs it in the global assembly cache. -u Uninstalls the runtime browser capabilities assembly from the global assembly cache. RemarksBrowser definition files can be either system-wide or application-specific, and each type is stored in a different location. System-wide browser definition files are stored in the %SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers directory. This directory contains predefined browser definition files that shipped with the corresponding version of the .NET Framework and any additional browser definition files copied there from software updates or service packs. Do not change the predefined browser definition files that come with ASP.NET, because service packs might update those files and overwrite your changes. Application-specific browser definition files can be placed in the application's App_Browsers directory. In both locations, browser definition files must have a .BROWSER file name extension. Using the ASP.NET Browser Registration tool has no effect on application-specific browser definition files stored in an application's App_Browsers directory. When browser definition files at the system level are modified, they do not automatically cause an update of browser capabilities for all applications. You must run the ASP.NET Browser Registration tool to update the browser capabilities assembly. The ASP.NET Browser Registration tool parses and compiles all system-wide browser definitions into an assembly and installs the assembly in the global assembly cache. If there are errors in the system-wide browser definitions, the tool reports those errors. The browser capabilities assembly is used by all Web applications on the system. Note that you can also programmatically recompile system-wide browser definition files by using the BrowserCapabilitiesCodeGenerator class. BehaviorWhen the ASP.NET Browser Registration tool runs, a new assembly is created and the effect on all Web applications is the same as if the Machine.config file was changed: All running Web applications are recycled and Microsoft Internet Information Services (IIS) is restarted. The tool also generates a random private token file, and creates a key file to sign the assembly so the assembly can be installed in the global assembly cache. The key file is removed when the tool is finished, leaving only the public key. At run time, browser definition file information is merged into a collection of known browsers in a BrowserCapabilitiesFactory object. When a request is made, ASP.NET identifies the requesting browser by the request header, and compiles an HttpBrowserCapabilities object that corresponds to the type of the requested browser. By contrast, browser definition files at the application level are automatically parsed and compiled on demand when the application is started. If any changes are made to the application's Browsers directory, the application is automatically recompiled. The ASP.NET Browser Registration tool has no effect on application-level browser information files. ExamplesTo parse and compile all system-wide browser definitions into an assembly and install the assembly into the global assembly cache, run Aspnet_regbrowsers.exe. The following command creates and installs the assembly: C:\WINDOWS\Microsoft.NET\Framework\<versionNumber>\aspnet_regsql.exe –i
You can also use the tool to remove the browser definition assembly from the global assembly cache. The following command removes the browser definitions assembly from the global assembly cache: aspnet_regsql.exe –u
To get help on using the ASP.NET Browser Registration tool, use the following command: aspnet_regsql.exe -?
Swapnil (swaps) http://swapsnet.spaces.live.com/
More on ASP.NEt compilationASP.NET Compilation Tool (Aspnet_compiler.exe) The ASP.NET Compilation tool can be used in two general ways: for in-place compilation and compilation for deployment, where a target output directory is specified. The following sections describe these scenarios. Compiling an Application in PlaceThe ASP.NET Compilation tool can compile an application in place, that is, it mimics the behavior of making multiple requests to the application, thus causing regular compilation. Users of a precompiled site will not experience a delay caused by compiling the page on first request. Note that if you are using an impersonated account, both the account and the logon user account must have write access to the target for precompilation to succeed. When you precompile a site in place, the following items apply: · The site retains its files and directory structure. · You must have compilers for all programming languages used by the site on the server. · If any file fails compilation, the entire site fails compilation. You can also recompile an application in place after adding new source files to it. The tool compiles only the new or changed files unless you include the -c option. Compiling an Application for DeploymentYou compile an application for deployment (compilation to a target location) by specifying the targetDir parameter. The targetDir can be the final location for the Web application, or the compiled application can be further deployed. Using the -u option compiles the application in such a way that you can make changes to certain files in the compiled application without recompiling it. Aspnet_compiler.exe makes a distinction between static and dynamic file types, and handles them differently when creating the resulting application. Static file types are those that do not have an associated compiler or build provider, such as files whose names have extensions such as .css, .gif, .htm, .html, .jpg, .js and so on. These files are simply copied to the target location, with their relative places in the directory structure preserved. Dynamic file types are those that have an associated compiler or build provider, including files with ASP.NET-specific file name extensions such as .asax, .ascx, .ashx, .aspx, .browser, .master, and so on. The ASP.NET Compilation tool generates assemblies from these files. If the -u option is omitted, the tool also creates files with the file name extension .COMPILED that map the original source files to their assembly. To ensure that the directory structure of the application source is preserved, the tool generates placeholder files in the corresponding locations in the target application. Fixed Assembly NamesSome scenarios, such as deploying a Web application using the MSI Windows Installer, require the use of consistent file names and contents, as well as consistent directory structures to identify assemblies or configuration settings for updates. In those cases, you can use the -fixednames option to specify that the ASP.NET Compilation tool should compile an assembly for each source file instead of using the where multiple pages are compiled into assemblies. This can lead to a large number of assemblies, so if you are concerned with scalability you should use this option with caution. Swapnil (swaps) http://swapsnet.spaces.live.com/
6月24日 ASP.NET Compilation Tool ASPnet_compiler.exeASP.NET Compilation Tool (Aspnet_compiler.exe) The ASP.NET Compilation tool (Aspnet_compiler.exe) enables you to compile an ASP.NET Web application, either in place or for deployment to a target location such as a production server. In-place compilation helps application performance because end users do not encounter a delay on the first request to the application while the application is compiled. Compilation for deployment can be performed in one of two ways: one that removes all source files, such as code-behind and markup files, or one that retains the markup files.
aspnet_compiler [-?] [-m metabasePath | -v virtualPath [-p physicalPath]] [[-u] [-f] [-d] [-fixednames] targetDir] [-c] [-errorstack] [-nologo] [[-keyfile file | -keycontainer container ] [-aptca] [-delaysign]]
-m metabasePath Specifies the full IIS metabase path of the application to be compiled. The IIS metabase is a hierarchical information store that is used to configure IIS. For example, the metabase path to the default IIS Web site is LM/W3SVC/1/ROOT. This option cannot be combined with the -v or -p options.
-v virtualPath Specifies the virtual path of the application to be compiled. If -p is also specified, the value of the accompanying physicalPath parameter is used to locate the application to be compiled. Otherwise, the IIS metabase is used, and the tool assumes that the source files are located under the default Web site (specified in the LM/W3SVC/1/ROOT metabase node). This option cannot be combined with the -m option.
-p physicalPath Specifies the full network path or local disk path of the root directory that contains the application to be compiled. If -p is not specified, the IIS metabase is used to find the directory. This option must be combined with the -v option, and cannot be combined with the -m option.
-u Specifies that Aspnet_compiler.exe should create a precompiled application that allows subsequent updates of contents such as .aspx pages. If this option is omitted, the resulting application contains only compiled files and cannot be updated on the deployment server. You can update the application only by changing the source markup files and recompiling. The targetDir parameter must be included.
-f Specifies that the tool should overwrite existing files in the targetDir directory and its subdirectories.
-d Overrides settings defined in the application's source configuration files to force debug information to be included in the compiled application. Otherwise, no debug output is emitted. You cannot use the -d option for in-place compilation; in-place compilation honors configuration settings for debugging options. targetDir The network path or local disk path to the root directory that will contain the compiled application. If the targetDir parameter is not included, the application is compiled in place. -c Specifies that the application to be compiled should be fully rebuilt. Components that have already been compiled are compiled again. If this option is omitted, the tool builds only those parts of the application that have been modified since compilation was last performed. -errorstack Specifies that the tool should include stack trace information if it fails to compile the application.
-keyfile file Specifies that the AssemblyKeyFileAttribute, which indicates the name of the file containing the public/private key pair that is used to generate a strong name, should be applied to the compiled assembly. This option must be combined with the -aptca option. If the attribute is already applied to the assembly in code files, Aspnet_compiler.exe throws an exception.
-keycontainer container Specifies that the AssemblyKeyNameAttribute, which indicates the name of the container for the public/private key pair that is used to generate a strong name, should be applied to the compiled assembly. This option must be combined with the -aptca option. If the attribute is already applied to the assembly in code files, Aspnet_compiler.exe throws an exception.
-aptca Specifies that the AllowPartiallyTrustedCallersAttribute, which allows partially trusted callers access to an assembly, should be applied to the strongly named assembly that Aspnet_compiler.exe generates. This option must be combined with the -keyfile or -keycontainer option. If the attribute is already applied to the assembly in code files, Aspnet_compiler.exe throws an exception.
-delaysign Specifies that the AssemblyDelaySignAttribute, which indicates that an assembly should be signed only with the public key token rather than with the public/private key pair, should be applied to the generated assembly. This option must be combined with the -keyfile or -keycontainer option. If the attribute is already applied to the assembly in code files, Aspnet_compiler.exe throws an exception. When you use the -delaysign option, the code produced by Aspnet_compilier.exe can run before the code is signed. You must ensure that the code is not vulnerable to malicious users before signing is completed.
-fixednames Specifies that one assembly should be generated for each page in the application. Each assembly is named with the virtual path of the original page unless the name would exceed the operating system limit for file names, in which case a hash is generated and used for the assembly name. You cannot use the -fixednames option for in-place compilation; in-place compilation honors configuration settings for compilation batch mode.
-nologo Suppresses the copyright message.
-? Displays command syntax and options for the tool.
Swapnil (Swaps) http://swapsnet.spaces.live.com/
6月23日 Solution for URL rewriting in ASP.NETFolks,
Solution for URL Rewriting in ASP.net
This solution provides a facility for ASP.net developers to not only rewrite URL's used in their applications in an extensable and manageable way. The solution is built into three sections which are:
1. The URL configuration manager 2. The Navigation manager 3. Postbacks Check the following Link http://www.codeproject.com/useritems/ASPnet_URL_Rewriting.asp Swapnil (swaps) http://swapsnet.spaces.live.com/
.NET Framework 2.0 ToolsFolks, I would like to share the internals of the .NET Framework 2.0, in terms of various tools provided by .NET Framework SDK. This tool facilitates us in creating, deploying and managing applications and components that target .NET Framework. Tools are defined into 4 different categories.
1) Configuration & Deployment 2) Debugging Tools 3) Security Tools 4) General Tools
The .Net SDK tools are installed as part of the .Net SDK, please check if you have the SDK installed, the standard place is C:\Program Files\Microsoft.NET\SDK.
Configuration & Deployment Tools
These are the set of tools which helps administrator to pre-compile application, either in place or for deployment. Helps Administrator in manipulating the contents of GAC – Global Assembly Cache. Helps you compile client application that communicates with XML Web services using technique called remoting.
Debugging Tools
Provides debugging services with a graphical interface to help application developers find and fix bugs in programs that target the runtime. Provides the debugging services of the common language runtime to Visual Studio or the WinDbg.exe debugging tool.
Security Tools
Manages certificates, certificate trust lists (CTLs), and certificate revocation lists (CRLs). Allows you to examine and modify machine, user, and enterprise-level code access security policies. Performs MSIL type safety verification checks and metadata validation checks on a specified assembly. Helps create assemblies with strong names. Sn.exe provides options for key management, signature generation, and signature verification.
General Tools
Reads text files that contain licensing information and produces a .licenses file that can be embedded in a common language runtime executable. Converts text files and .resx (XML-based resource format) files to .NET common language runtime binary .resources files that can be embedded in a runtime binary executable or compiled into satellite assemblies. Allows you to quickly and easily localize Windows Forms forms.
We will cover each of the tools under above mentioned categories in upcoming articles.
Swapnil (swaps) 6月20日 VS 2008 Multi Targeting SupportFolks
VS 2008 Multi-Targeting Support
Earlier this month at TechEd Microsoft announced the official name of Visual Studio "Orcas" - which will be called Visual Studio 2008. Microsoft also announced that the official name for the .NET Framework "Orcas" release will be called .NET Framework 3.5 (it includes the new LINQ support, integrated ASP.NET AJAX support, new ASP.NET data controls, and more).
VS 2008 and .NET 3.5 Beta 2 will ship later this summer, and the Beta 2 release will support a go-live license for those who want to put applications into production using the new features immediately. http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx Swapnil (swaps) http://swapsnet.spaces.live.com/
Repeater Control - ASP.NET 2.0Repeater control: The Repeater control is used to display the data items in representing list. The content and layout of list items in Repeater is defined using Templates. Every Repeater must define an ItemTemplate. Template: There are the following Templates used in repeater control.
FooterTemplate: The FooterTemplate determines the content and layout of the list footer. It is used to specify an optional footer row. For Example: <FooterTemplate></table></FooterTemplate>
HeaderTemplate: The HeaderTemplate determines the content and layout of the list header. It is used to specify an optional header row. For Example: <HeaderTemplate> <tr> <td><b>Roll no</b></td> <td><b>Name</b></td> <td><b>Course</b></td> </tr> </HeaderTemplate> ItemTemplate: It defines the content and layout of items within the list. For Example: <ItemTemplate> <tr> <td><%# DataBinder.Eval(Container,"dataitem.Roll no") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Name") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Course") %></td> </tr> </ItemTemplate> AlternatingItemTemplate: It is used as follows: For Example: <AlternatingItemTemplate> <tr style="background-color:Yellow"> <td><%# DataBinder.Eval(Container,"dataitem.Roll no") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Name") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Course") %></td> </tr> </AlternatingItemTemplate>
SeparatorTemplate: The SeparatorTemplate is rendered between items (and alternating items). Repeater has no built-in layout or styles. You must explicitly declare all HTML layout, formatting, and style tags within the templates of the control. In the following section you will learn how you can access data into Repeater control from DataBase.
For Example:
To create a list within an HTML table, you might declare the <table> tag in the HeaderTemplate, a table row in the ItemTemplate, and the </table> tag in the FooterTemplate as follows-
Default.aspx file:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Debug="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Repeater ID="Repeater1" runat="server" OnItemCommand="repeater1_itemcomand"> <HeaderTemplate> <table border=5> <tr> <td><b>Roll no</b></td> <td><b>Name</b></td> <td><b>Course</b></td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td><%# DataBinder.Eval(Container,"DataItem.Rollno") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Name") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Course") %></td> </tr> </ItemTemplate> <AlternatingItemTemplate> <tr style="background-color:Yellow"> <td><%# DataBinder.Eval(Container,"dataitem.Rollno") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Name") %></td> <td><%# DataBinder.Eval(Container,"dataitem.Course") %></td> </tr> </AlternatingItemTemplate> <FooterTemplate></table></FooterTemplate> </asp:Repeater> </div> </form> </body> </html>
We write the code on page load to access the table.
Default.aspx.cs:
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page { SqlConnection con; SqlCommand com = new SqlCommand(); protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection("Data Source=MCN004;Initial Catalog=student; uid=sa;pwd="); com.Connection = con; com.CommandText = "select * from student"; con.Open(); Repeater1.DataSource= com.ExecuteReader(); Repeater1.DataBind(); con.Close(); } protected void repeater1_itemcomand(object source, RepeaterCommandEventArgs e) {} }
Swapnil (Swaps) http://swapsnet.spaces.live.com/
6月19日 ASP.NET Internals - Bridge between ISAPI & Applications DomainsFolks,
In this article describe's the bridge between managed and unmanaged worlds and how the two collaborate to set up the processing environment needed by ASP.NET requests to be processed.
Click on this link and scroll below to read complete article.
Swapnil (swaps)
Form View Control ASP.NET 2.0Form View
FormView is a data-bound user interface control that renders a single record at a time from its associated data source, optionally providing paging buttons to navigate between records. It is similar to the DetailsView control, except that it requires the user to define the rendering of each item using templates, instead of using data control fields.
Like DetailsView, FormView keeps track of the current item being rendered, and can optionally support paging over multiple data items when the data source returns a list.
The FormView supports automatic Updates, Inserts, and Deletes through its associated data source control just like the DetailsView control. To define the input UI for editing or inserting, you define an EditItemTemplate or InsertItemTemplate in addition to the ItemTemplate. In this template you will data bind input controls such as TextBox, CheckBox, or DropDownList to the fields of the data source. Data bindings in these templates use a "two-way" data binding syntax, however, to allow the FormView to extract the values of input controls from the template in order to pass to the data source. These data bindings use the new
We use the FormView control for display a single record from the data source; there are seven types of Templates in which most of the Templates are optional.
You must create a Template for the mode in which the FormView control is configured. For example, a FormView control that supports updating records must have an EditItemTemplate defined.
Types of Templates: HeaderTemplate FooterTemplate ItemTemplate InsertItemTemplate EditItemTemplate EmptyDataTemplate PagerTemplate
HeaderTemplate:
FooterTemplate: Footer Template defines the contents which we want to display in the footer row of the FormView Control.
ItemTemplates defines the contents for the FormView row when it is in read only mode. This template basically used for display the existing data from the data source.
InsertItemTemplate:
InsertItemTemplates defines the contents for the FormView row when it is in insert mode. This template contains the input controls and commands for inserting the new record.
EditItemTemplate:
EditItemTemplates defines the contents for the FormView row when it is in edit mode. This template contains the input controls and commands for editing the existing record.
EmptyDataTemplate:
EmptyDataTemplate basically used for showing the alert to the user if there is no record in the bound column.
PagerTemplate:
PagerTemplate defines the content for the pager row when the "AllowPaging" property is true. It also contains the controls by using that, user can navigate to another record.
Swapnil (swaps) http://swapsnet.spaces.live.com/
6月17日 Data List Control - ASP.NET 2.0DataList Control
The DataList control displays data items in a repeating list, and optionally supports selecting and editing the items. The content and layout of list items in DataList is defined using templates. At a minimum, every DataList must define an ItemTemplate; however, several optional templates can be used to customize the appearance of the list.
Various Templates Supported by Data List
ItemTemplate - Defines the content and layout of items within the list. Required.
AlternatingItemTemplate - If defined, determines the content and layout of alternating items. If not defined, ItemTemplate is used.
SeparatorTemplate (new) - If defined, is rendered between items (and alternating items). If not defined, a separator is not rendered.
SelectedItemTemplate - If defined, determines the content and layout of the selected item. If not defined, ItemTemplate (AlternatingItemTemplate) is used.
EditItemTemplate - If defined, determines the content and layout of the item being edited. If not defined, ItemTemplate (AlternatingItemTemplate, SelectedItemTemplate) is used.
HeaderTemplate - If defined, determines the content and layout of the list header. If not defined, the header is not rendered.
FooterTemplate - If defined, determines the content and layout of the list footer. If not defined, the footer is not rendered.
Templates define the HTML elements and controls that should be displayed for an item, as well as the layout of these elements. Style formatting -- font, color, and border attributes -- is set via styles. Each template has its own style property. For example, styles for the EditItemTemplate are set through the EditItemStyle property.
Selecting Items in DataListYou can customize the content and appearance of the selected item through the SelectedItemTemplate property. The SelectedItemTemplate is controlled by the SelectedIndex property. By default the value of SelectedIndex is -1, meaning none of the items in the list is selected. When SelectedIndex is set to a particular item, that item is displayed using the SelectedItemTemplate.
Editing DataList ItemsThe DataList control supports in-place editing of the data in an item through its EditItemTemplate property. The EditItemTemplate defines the content and appearance of the item when it is being edited.
The EditItemTemplate interacts with another property: EditItemIndex. By default, the value of EditItemIndex is -1, meaning none of the items in the list is being edited. When EditItemIndex is set to a particular item, that item is displayed using the EditItemTemplate.
The EditItemTemplate typically contains "update" and "cancel" command buttons. These buttons cause the UpdateCommand and CancelCommand events to be thrown, respectively. It's up to you to handle these events in your code. The typical logic for "cancel" sets EditItemIndex to -1, and then rebinds the data to the DataList.
The typical logic for "update" updates the data source, sets EditItemIndex to -1, and then rebinds the data to the DataList.
DataList renders additional elements, like table rows and cells and spans containing style attributes, outside of the template definition to enable layout formatting. For example, DataList supports RepeatColumns and RepeatDirection properties that specify whether data should be rendered in multiple columns, and in which direction (vertical or horizontal) the data items should be rendered.
Events in DataList
You can fire a command from inside a DataList template that is passed to an event handler wired to the DataList itself. For example, a LinkButton inside the ItemTemplate might fire a Select command. By setting the OnSelectedIndexChanged property of the DataList, you can call an event handler in response to this command.
Note that while the DataList recognizes a few special commands such as Select and Edit/Update/Cancel, the command string fired inside a template can be any arbitrary string. For all commands, the DataList's OnItemCommand is fired.
Note that unlike GridView, DataList does not support automatically updating and deleting using a data source control, so you need to write code to handle the edit, update, and delete commands yourself (using the same model as was supported in ASP.NET v1.x).
Swapnil (Swaps) http://swapsnet.spaces.live.com/
GridView ExamplesFolks,
This article illustrates how to accomplish a number of common tasks with the Microsoft ASP.NET 2.0 GridView control. Each task is accompanied by a description of the new concepts covered, and the complete working examples are available for download with this article. (122 printed pages).
Swapnil (Swaps)
ASP.NET 2.0 Frequently Asked QuestionsFolks,
Find answers to common questions about ASP.NET 2.0 and Web development
Swapnil (Swaps)
6月16日 Creating Packaged ASP.NET Setup Programs ASP.NET 2.0Folks,
You have built an ASP.NET Web Application using Visual Studio 2005, and want to enable customers to automatically install and deploy it on servers via an easy setup program.
Specifically, you want to create a standard Windows setup program that will create and configure the application on IIS, copy all of the application’s files to the appropriate location on the server, and ensure that ASP.NET 2.0 is correctly mapped to run the application. You also want the setup program to prompt the customer for the database location that the new application should use, and have the setup program automatically update the web.config file with the database connectionstring settings the customer provided. The below link demonstrates step-by-step how to create and use one. Swapnil (Swaps) http://swapsnet.spaces.live.com/
Details View Control - ASP.NEt 2.0The Details View Control
Many applications need to work on a single record at a time. In ASP.NET 1.x, there is no built-in support for this scenario. Creating a single record view is possible but requires some coding effort on your part. You have to fetch the record first, then bind its fields to a data-bound form, and optionally provide paging buttons to navigate between records. The need to display the contents of a single record is fairly common when you build master/detail views. Typically, the user selects a master record from a grid and the application drills down to show all the available fields. By combining GridView and DetailsView, you build hierarchical views with very little code. The DetailsView control can automatically bind to any data source control and take advantage of its set of data operations. The control can automatically page, update, insert, and delete data items in the underlying data source as long as the data source supports these operations. In most cases, no code is required to set up any of these operations, as shown here:
<asp:detailsview runat="server" id="det" datasourceid="MySource" autogenerateeditbutton="true" autogenerateinsertbutton="true" autogeneratedeletebutton="true" allowpaging="true" headertext="Employees"> <pagersettings mode="NextPreviousFirstLast" firstpageimageurl="images/first.gif" lastpageimageurl="images/last.gif" nextpageimageurl="images/next.gif" previouspageimageurl="images/prev.gif" /> </asp:detailsview>
The user interface of the DetailsView control can be customized using data fields and styles in a way that is similar to the GridView. The DetailsView doesn't support custom templates as this specific capability has been entirely factored into the new FormView control. The DetailsView can have a command bar with any combination of Edit, Delete, and New buttons. When you click Edit or New, the control renders in Edit or Insert mode and the contents of fields are displayed in textboxes. The working mode can be controlled through the Mode and DefaultMode properties. The DetailsView control lends itself very well to implementing no-code master/details scenarios. Along with Edit and Delete buttons, the GridView control supports the Select button, which is also predefined. You enable this button on a per-row basis by setting the AutoGenerateSelectButton property to true. When the users click on this button, the current row enters the selected state and its zero-based index is assigned to the SelectedIndex property of the GridView. In addition, the GridView control raises the SelectedIndexChanged event. Applications can hook up to this event and run custom code. In ASP.NET 2.0 there's no need to handle the SelectedIndexChanged event if you want to build a master/detail view. You can drop a GridView and a DetailsView control on the page and bind each to a data source. The trick for codeless master/detail is to bind the detail control to a data source represented by the currently selected record, as shown in the following:
<asp:sqldatasource runat="server" id="MyDetailSource" ••• selectcommand="SELECT * FROM customers" filterexpression="customerid='@customerid'"> <filterparameters> <asp:ControlParameter Name="customerid" ControlId="masterGrid" PropertyName="SelectedValue" /> </filterparameters> </asp:sqldatasource>
The FilterExpression property of a data source object defines the WHERE clause for the base query specified by SelectCommand. Parameter values can be specified in a variety of ways, including through direct binding with a control property. The <ControlParameter> object sets the @customerid parameter to the value stored in the SelectedValue property of the master grid control.
Swapnil (Swaps) http://swapsnet.spaces.live.com/
6月13日 How Software is BuiltFolks
The website is called How Software is Built, and it's an investigation of the similarities and differences of closed-source* versus open-source delivery models and I've been reading it for a while. I always learn something from each of the people that they interview. The project was "commissioned" by folks here at MS, but if you want details, click here
Swapnil (swaps)
Script# + ReflectorFolks,
The new .reflector assembly list file feature of .NET Reflector can be used to streamline the class browsing experience for Script#
Check out this link
Swapnil (swaps)
|
|
|