用GridView实现孟子的DataGrid跨页多选,大家来看看错在哪里了。
Default.aspx:
<%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default.aspx.cs " Inherits= "_Default " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> GridView实现跨页多选 </title>
<script type= "text/javascript ">
function AddRemoveValues(oChk)
{
//在处理这个地方需要注意的是:你保存的值应该具有唯一性,这样才能不会替换错误的项。
if(oChk.checked)
document.getElementById( "HdnSelectedValues ").value += ", " + oChk.value;
else
document.getElementById( "HdnSelectedValues ").value = document.getElementById( "HdnSelectedValues ").value.replace( ", " + oChk.value, " ");
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<table align= "center " border= "1 ">
<tr>
<td align= "center ">
<asp:GridView ID= "GridView1 " runat= "server " AutoGenerateColumns= "False " CellPadding= "4 " ForeColor= "#333333 " GridLines= "None " AllowPaging= "True " OnPageIndexChanging= "GridView1_PageIndexChanging " OnRowCreated= "GridView1_RowCreated " OnRowDataBound= "GridView1_RowDataBound ">
<FooterStyle BackColor= "#990000 " Font-Bold= "True " ForeColor= "White " />
<RowStyle BackColor= "#FFFBD6 " ForeColor= "#333333 " />