日期:2014-05-18  浏览次数:20406 次

关于跨页面多选的问题(很奇怪)
曾看过孟子写的关于“跨页面多选的问题”一文,今又在一书上看到同样一文,例子是一样的只是数据库改啦!(不知改的是否有问题)现将代码和问题帖出来,请大家帮忙看看!
---------------------------------------
  <%@   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>
        <style   type= "text/css ">
*   {FONT-SIZE:12PX}
#Status   {text-align:left}
</style>
<script   language= "javascript "   type= "text/javascript ">
function   AddRemoveValues(oChk)   {  
//确定保存的值具有唯一性,这样才能不会替换错误的项。
if(oChk.checked)
from1.Hselcet.value   +=   ", "   +   oChk.value;  
else
from1.Hselcet.value   =   from1.Hselcet.value.replace( ", "   +   oChk.value, " ");  
}
</script>

</head>
<body>
        <form   id= "from1 "   runat= "server ">
<div   style= "text-align:center ">
<div   id= "Status ">
</div>
                        <table   border= "1 "   cellpadding= "0 "   cellspacing= "0 ">
                                <tr>
                                        <td   style= "text-align:   center ">
                                                跨页面多选 </td>
                                </tr>
                                <tr>
                                        <td   style= "text-align:   center ">
<asp:GridView   id= "GridView1 "   HorizontalAlign= "Center "   AutoGenerateColumns= "False "
AllowPaging= "True "   runat= "server "   PageSize= "5 "   OnPageIndexChanging= "GridView1_PageIndexChanging "   OnRowDataBound= "GridView1_RowDataBound "   Width= "472px ">
<HeaderStyle   BackColor= "#AAAADD "   Font-Bold= "True "   HorizontalAlign= "Center "> </HeaderStyle>
<PagerStyle   HorizontalAlign= "Right "> </PagerStyle>
<Columns>
<asp:TemplateField   HeaderText= "选择 ">
<ItemTemplate>