Front-end page
Copy codeThe Code is as follows: <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>
BackgroundCopy codeThe Code is as follows: 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 FileCopy codeThe Code is as follows: $ (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 ") // update Repeater locally
})
})
Source code download