I was frustrated. Now I found that the gridview can use a custom template like datalist, which I never thought would work .~
Today, I am lazy. I am working on the background. I don't want to implement custom pages. I want to use the pagination that comes with the gridview... so I learned the following things !!!
The design view is as follows: only the sqldatasource data source control is used.
Apply the format to the gridview. Run the following:(Note: The paging effect is normal)
HtmlSource codeAs follows:
Code
< ASP: gridview ID = "Gridview1" Runat = "Server" Autogeneratecolumns = "False" Performanceid = "Sqlperformance1"
Allowpaging = "True" Backcolor = "White" Bordercolor = "#999999" Borderstyle = "NONE"
Borderwidth = "1px" Cellpadding = "3" Gridlines = "Vertical" Pagesize = "1" >
< Rowstyle Backcolor = "# Eeeeee" Forecolor = "Black" />
< Columns >
< ASP: templatefield >
< Itemtemplate >
< Table Width = "100%" Border = "1" Cellspacing = "0" Cellpadding = "0" >
< Tr >
< TD >
< ASP: Label ID = "Label4" Runat = "Server" Text = '<% # BIND ("Ntitle") % > '> </ ASP: Label >
</ TD >
< TD >
< ASP: Label ID = "Label5" Runat = "Server" Text = '<% # BIND ("ndate") % > '> </ ASP: Label >
</ TD >
< TD >
Price
</ TD >
</ Tr >
< Tr >
< TD Colspan = "3" >
< ASP: Label ID = "Label6" Runat = "Server" Text = '<% # BIND ("ndescription") % > '> </ ASP: Label >
</ TD >
</ Tr >
< Tr >
< TD Colspan = "3" >
< HR />
</ TD >
</ Tr >
</ Table >
</ Itemtemplate >
</ ASP: templatefield >
</ Columns >
< Footerstyle Backcolor = "# Cccccc" Forecolor = "Black" />
< Pagerstyle Backcolor = "#999999" Forecolor = "Black" Horizontalalign = "Center" />
< Selectedrowstyle Backcolor = "# 008a8c" Font-bold = "True" Forecolor = "White" />
< Headerstyle Backcolor = "#000084" Font-bold = "True" Forecolor = "White" />
< Alternatingrowstyle Backcolor = "# Dcdcdc" />
</ ASP: gridview >
< ASP: sqldatasource ID = "Sqlperformance1" Runat = "Server" Connectionstring = "Data Source =.; initial catalog = yingcedb; persist Security info = true; user id = sa; Password ="
Providername = "System. Data. sqlclient" Selectcommand = "Select [Ntitle], [ndate], [ndescription], [nkeyword] from [yingce_new]" >
</ ASP: sqldatasource >
Game over! Thank you !! Hoho... don't swear .~~