This post only refers to the previous post "ASP. NET data paging Part 3-in conjunction with custom control to process the UI rendering of the gridview ", provides custom control for everyone to download, that is, enhance the pagination function of the gridview, and then rewrite some detailed functions. The new features are as follows:
* The CSS and JavaScript required by this wizardgridview are all embedded in the DLL. In this way, the page that references the wizardgridview does not need to reference external CSS files.
* Five "attributes" are added 」,ProgramMembers can directly set the parameters in the "properties" Window of VS 2005/2008 on the GUI, as shown on the Right of 1.
* The customfontsize attribute is added to control the font size (small) of the entire gridview without being affected by the HTML settings on the reference page.
* Three of the new attributes are the background colors that enable programmers to customize "data rows with singular rows, double rows, and mouse placed on them.
* A small icon is added. When you add wizardgridview to the "toolbox" of VS 2005/2008, there will be a custom small graph.
* To work with some software used to create CHM files, add comments that can be recognized by the sandcastle software.
* Anyone who has written custom controls should know that when a class directly inherits from Microsoft's native gridview class, it will cause the referenced ASPX page, this customizes the intelliisense function in the "columns" tag of the gridview. Failure. Therefore, I have added two classes, wizardtemplatefield and wizardboundfield, to replace Microsoft's native templatefield and boundfield class. In this way, when the programmer references In the wizardgridview control, the intelliisense in the "columns" tag takes effect again. See 2.
Figure 1 adds five new attributes, which are concentrated in the same Index tab in the "properties" Window of Visual Studio.
Figure 2 The intelliisense in the "columns" tag of the wizardgridview still takes effect
Example of this postCodeDownload point:
Http://files.cnblogs.com/WizardWu/080928.zip
(In this example, the SQL server's northwind database is required)
You only need to enable solution file (. sln) directly in VS 2005. The "wizardgridview" folder in it is the source code of custom control. There are two website examples for demo:The "sqldatasource" folder and the "objectdatasource" folder automatically link your local SQL Server 2000/2005 northwind database. The latter must be in the northwind of SQL Server 2005 first, createThe stored procedure used for data paging (also attached to the download code of this post) can properly link your local SQL Server 2005 northwind database.
In the download code of this post, the new version of "data paging" stored procedure is added with the ability to handle distinct needs (in fact, it is to replace distinct with group by for processing ). In the first two posts of this series, "ASP. NET data paging Article 1-explore paging principles and the row_number function of SQL Server 2005 "," ASP. NET data paging Article 2-example downloading: if we do not use stored procedure for "Data paging" processing, when there are 1 million records in the data table, Asp. the default behavior of net is that every time the user clicks the page number to change the page, all the 1 million records are retrieved again. This will cause a large waste of system memory, greatly reducing the performance, and even causing a crash.
In the previous posts of this series, we used to process the stored procedure of "data paging" in SQL Server 2005, mainly using a row_number function built in SQL Server 2005 for processing. HoweverA disadvantage of the row_number function is that it will invalidate the function of the distinct statement. Therefore, the new version of stored procedure in this post replaces distinct with group. Download the code in this postIn the "obejctdatasource" demo website, the Dal layer and dal2 layer in the app_code folder will also pass a strgroupby parameter to this stored procedure dedicated to "Data paging.
Code that references this custom control page
<% @ Register assembly = " Wizardgridview " Namespace = " Wizardgridview " Tagprefix = " Wizard " %>
< Wizard: wizardgridview ID = "Wizardgridview1" Runat = "Server" Allowpaging = "True" Allowsorting = "True"
Autogeneratecolumns = "False" Datakeynames = "Orderid" Performanceid = "Sqlperformance1"
Wizardcustompager = "True" >
< Columns >
< ASP: boundfield Datafield = "Orderid" Headertext = "Orderid" Insertvisible = "False" Readonly = "True"
Sortexpression = "Orderid" />
< ASP: boundfield Datafield = "Customerid" Headertext = "Customerid" Sortexpression = "Customerid" />
< ASP: boundfield Datafield = "Orderdate" Headertext = "Orderdate" Sortexpression = "Orderdate" />
< ASP: boundfield Datafield = "Shipname" Headertext = "Shipname" Sortexpression = "Shipname" />
< ASP: boundfield Datafield = "Shipcity" Headertext = "Shipcity" Sortexpression = "Shipcity" />
</ Columns >
</ Wizard: wizardgridview >
Asp: sqldatasource id =" sqldatasource1 " runat =" server " connectionstring =" <% $ connectionstrings: connstring_sqlclient %> "
selectcommand =" select [orderid], [customerid], [orderdate], [shipname], [shipcity] from [orders] " >
Asp: sqldatasource >
Or with intelliisense like this:
< Wizard: wizardgridview ID = "Wizardgridview1" Runat = "Server" Allowpaging = "True" Allowsorting = "True"
Autogeneratecolumns = "False" Datakeynames = "Orderid" Performanceid = "Sqlperformance1"
Wizardcustompager = "True" >
< Columns >
< ASP: wizardboundfield Datafield = "Orderid" Headertext = "Orderid" Insertvisible = "False" Readonly = "True"
Sortexpression = "Orderid" />
< ASP: wizardtemplatefield />