Front-end page
< Head runat = " Server " >
< Title > No title page </ Title >
< Script SRC = " JS/jquery-1.5.1.min.js " Type = " Text/JavaScript " > </ Script >
< Script SRC = " JS/demo. js " Type = " Text/JavaScript " > </ Script >
</ Head >
< Body >
< Form ID = " Form1 " Runat = " Server " >
< Div ID = " Content " >
< Table >
< ASP: repeater ID = " Repeater1 " Runat = " Server " >
< Headertemplate >
< Tr >
< TD >
< Input type = " Checkbox " >
</ TD >
< TD >
Student ID
</ TD >
< TD >
Student name
</ TD >
</ Tr >
</ Headertemplate >
< Itemtemplate >
< Tr >
< TD >
< Input type = " Checkbox " >
</ TD >
< TD Style = " Text-align: Center " >
<% # Eval ( " Studentid " ) %>
</ TD >
< TD Style = " Text-align: Center " >
<% # Eval ( " Name " ) %>
</ TD >
</ Tr >
</ Itemtemplate >
</ ASP: Repeater >
</ Table >
</ Div >
< Div >
< Input ID = " Btndel " Type = " Button " Value = " Delete " > </ Input >
</ Div >
</ Form >
</ Body >
Background
Protected Void Page_load ( Object Sender, eventargs E)
{
Studentbll _ BLL = New Studentbll ();
If (Request. querystring [ " ID " ] ! = "" && Request. querystring [ " ID " ] ! = Null )
{
String _ IDS = Request. querystring [ " ID " ];
_ BLL. Delete (_ IDs );
}
Repeater1.datasource = _ BLL. selectall ();
Repeater1.databind ();
}
Demo. JS File
$ ( Function (){
// This function removes spaces and line breaks at the beginning and end of a string in JavaScript.
Function Trim (STR)
{
VaR Statrindex;
VaR Endindes;
For (I = 0 ; I < Str. length; I ++ )
{
VaR K = Str. charat (I );
If (K ! = " \ N " && K ! = " " )
{
Statrindex = I; Break ;
}
}
For (I = Str. Length - 1 ; I < Str. length; I -- )
{
VaR K = Str. charat (I );
If (K ! = " \ N " && K ! = " " )
{
Endindes = I; Break ;
}
}
Return Str. substring (statrindex, endindes + 1 );
};
$ ( " # Btndel " ). Click ( Function (){
VaR IDS = " '' " ;
$ ( " # Content input: checked " ). Parent (). Next (). Each ( Function (I ){
IDS = IDS + " ,' " + Trim ($ ( This ). Text ()) + " ' " ;
});
$ ( " # Content " ). Load ( " Default. aspx? Id = " + Encodeuri (IDS) + " # P-getting-started # Content " ) // Partial update Repeater
})
})
source code download