Paging with someone else's.
JS Code
<script language= "javascript" type= "Text/javascript" >
function SelectAll (Chkcontrol)
{
var Chkall=chkcontrol;
state=chkall.checked;
elem=chkall.form.elements;
for (i=0;i<elem.length;i++)
{
if (elem[i].type== "checkbox" && elem[i]!=chkall.id)
{
if (elem[i].checked!=state)
{
Elem[i].click ();
}
}
}
}
</script>
<script type= "Text/javascript" >
function SelectAll (box)
{
for (var i=0;i <document.form1.elements.length;i++)
{
var e=document.form1.elements[i];
if ((e.type== ' checkbox '))
{
var o=e.name.lastindexof (' Ckbindex ');
if (o!=-1)
{
e.checked=box.checked;
}
}
}
}
</script>
ASPX page
<div class= "Heisemoban_yinyue_3" >
<div class= "Heisemoban_yinyue_4" >
<div class= "Heisemoban_yinyue_5" >
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
<TD width= "6%" height= ">"
<asp:checkbox id= "Checkall" runat= "Server" onclick= "Javascript:selectall" (this); "/>
</td>
<TD width= "8%" height= "style=" FONT-SIZE:14PX; Color: #0058B0 ">
Select All </td>
<TD width= "14%" height= "style=" FONT-SIZE:14PX; Color: #0058B0 ">
<asp:linkbutton id= "Lbbofang" runat= "Server" > Continuous playback </asp:LinkButton>
</td>
<TD width= "52%" height= "style=" FONT-SIZE:14PX; Color: #0058B0 ">
<asp:linkbutton id= "Lbdelete" runat= "Server" onclick= "Lbdelete_click" commandname= "Delete" commandargument= "< % # Eval ("MusicID")%> '
onclientclick= "return confirm (' Are you sure you want to delete this record?] '); "> Delete </asp:LinkButton>
</td>
<TD width= "20%" height= "style=" FONT-SIZE:14PX; Color: #0058B0 ">
<a href= "T_music_add.aspx" >
Add Network Music </a>
</td>
</tr>
</table>
</div>
</div>
<div class= "Heisemoban_yinyue_6" >
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
<TD width= "5%" height= ">"
&nbsp;</td>
<TD width= "54%" height= "style=" "Font-weight:bold" >
Music Name
</td>
<TD width= "15%" height= "style=" "Font-weight:bold" >
Background music </td>
<TD width= "9%" height= "style=" "Font-weight:bold" >
Modify </td>
<TD width= "8%" height= "style=" "Font-weight:bold" >
Mobile </td>
<TD width= "9%" height= "style=" "Font-weight:bold" >
Delete </td>
</tr>
<tr>
<TD height= "1" colspan= "6" >
<img src= "Images/heisexuanxian_03.jpg"/></td>
</tr>
<asp:repeater id= "Repeater1" runat= "Server" onitemcommand= "Repeater1_itemcommand" >
<ItemTemplate>
<tr>
<TD align= "left" style= "height:30px" >
<asp:checkbox runat= "Server" id= "Ckbindex" text= ' <% #Eval ("MusicID")%> '/>
</td>
<TD align= "left" style= "height:30px" >
<%# Eval ("Name")%>
</td>
<TD align= "left" style= "height:30px" >
<%# Showislogin (Eval ("Beijing"))%>
</td>
<TD align= "left" style= "height:30px" >
<a href= "t_music_app.aspx?id=<%# Eval (" MusicID ")%>" > Modify </a>
</td>
<TD align= "left" style= "height:30px" >
<a href= "javascript:void (0)" onclick= "Showfloat ()" >
Mobile </a></td>
<TD align= "left" style= "height:30px" >
<asp:linkbutton id= "LinkButton1" runat= "Server" Commandname= "Delete" commandargument= ' <%# Eval ("musicid")% > '
onclientclick= "return confirm (' Are you sure you want to delete this record?] '); "> Delete </asp:LinkButton>
</td>
</tr>
<tr>
<TD height= "1" colspan= "6" >
<img src= "Images/heisexuanxian_03.jpg"/></td>
</tr>
</ItemTemplate>
</asp:Repeater>
<tr>
<TD height= ">"
<input title= "Check/uncheck" onclick= "Checkall (this.form)" type= "checkbox" Name= "Chkall"
Id= "Checkbox1"/></td>
<TD height= "colspan=" 5 ">
<a href= "#" > All </a> <a href= "#" > Continuous play </a> <a href= "#" >
<asp:linkbutton id= "LinkButton3" runat= "onclick=" Linkbutton3_click "onclientclick=" return confirm (' Are you sure you want to delete it? ') ' > Delete </asp:LinkButton></a>
</td>
</tr>
<tr>
<TD height= "colspan=" 6 "style=" Background-color: #202125 ">
<samp style= "margin-left:15px;" >
<webdiyer:aspnetpager id= "AspNetPager1" runat= "Server" width= "100%" onpagechanged= "aspnetpager1_pagechanged"
horizontalalign= "Center" custominfohtml= Total%pagecount% page, total%recordcount% bar, current%currentpageindex% page,%pagesize% per page "
firstpagetext= "Home" lastpagetext= "last" nextpagetext= "next page" numericbuttontextformatstring= "{0}"
prevpagetext= "prev" showpageindexbox= "Always" submitbuttontext= "Go" pagingbuttonspacing= "10px"
pagesize= "textafterpageindexbox=" page "textbeforepageindexbox=" Go to "urlpaging=" True "
height= "30px" showcustominfosection= "right" >
</webdiyer:AspNetPager>
</samp>
</td>
</tr>
</table>
</div>
</div>
CS Page
int intmusicid = 0;
protected void Page_Load (object sender, EventArgs e)
{
& nbsp; //intmusicid = Int. Parse (request.querystring["id"). ToString ());
if (! IsPostBack)
{
info_show ();
}
}
protected void info_show ()
{
& nbsp String strSQL = "Select Musicid,name from [music] where sortid=2";
//datatable dt = DAL. Sqlserver2000.runselect (strSQL);
//repeater1.datasource = DT;
//repeater1.databind ();
int pagesize = aspnetpager1.pagesize;//number of pages. How many data per page
int pageindex = aspnetpager1.currentpageindex;//The first few pages
String str1 = "SELECT * from Music where sortid=2 order by musicid DESC";//return total number of records
String str2 = ' Select top ' + pagesize + ' * from music WHERE sortid=2 and MusicID not in (select Top + pagesize * ( pageindex-1) + "MusicID from Music order by MusicID", ORDER by musicid Desc ";
DataTable dt = DAL. Sqlserver2000.runselect (STR1);
int count = dt. Total number of rows.count;//records
Aspnetpager1.recordcount = total number of count;//records
Aspnetpager1.databind ();
DT = DAL. Sqlserver2000.runselect (STR2);
Repeater1.datasource = DT;
Repeater1.databind ();
}
Paging
protected void Aspnetpager1_pagechanged (object sender, EventArgs e)
{
Info_show ();
}
protected void Repeater1_itemcommand (object source, RepeaterCommandEventArgs e)
{
int id = convert.toint32 (e.commandargument);
if (E.commandname = "Delete")
{
String strSQL = "Update music set where musicid=" + id;//put in Recycle Bin
String strSQL = "Delete from [music] where musicid=" + id;//This sentence is deleted directly. Delete statement
Response.Write (strSQL);
DAL. Sqlserver2000.runsql (strSQL);
Classmessage.showandredirect (this. Page, "delete success!", "t_music_sort.aspx");
}
if (E.commandname = = "Del")
{
String a = E.commandargument.tostring ();
Response.Write (a);
}
}
protected void Linkbutton3_click (object sender, EventArgs e)
{
foreach (RepeaterItem Item in Repeater1.items)
{
CheckBox chk = (checkbox) Item.findcontrol ("Ckbindex");
if (CHK). Checked)
{
Page.ClientScript.RegisterStartupScript (GetType (), "a", "<script>alert" (' record ID number to be deleted in bulk: "+chk. text+ "');</script>");
Response.Write ("Record ID number to be deleted in bulk:" + chk.) Text + "<br/>");
String strSQL = "Delete from music where musicid=" + chk. text;//this sentence is directly deleted. Delete statement
Response.Write (strSQL);
Response.Write (strSQL);
DAL. Sqlserver2000.runsql (strSQL);
Classmessage.showandredirect (this. Page, "delete success!", "t_music_sort.aspx");
}
}
}
protected void Lbdelete_click (object sender, EventArgs e)
{
foreach (RepeaterItem Item in Repeater1.items)
{
CheckBox chk = (checkbox) Item.findcontrol ("Ckbindex");
if (CHK). Checked)
{
Page.ClientScript.RegisterStartupScript (GetType (), "a", "<script>alert" (' record ID number to be deleted in bulk: "+chk. text+ "');</script>");
Response.Write ("Record ID number to be deleted in bulk:" + chk.) Text + "<br/>");
String strSQL = "Delete from music where musicid=" + chk. text;//this sentence is directly deleted. Delete statement
Response.Write (strSQL);
Response.Write (strSQL);
DAL. Sqlserver2000.runsql (strSQL);
Classmessage.showandredirect (this. Page, "delete success!", "t_music_sort.aspx");
}
}
}