日期:2014-05-20  浏览次数:20400 次

后台怎么改变客户端css的className呢
大年初一,祝大家新年快乐,万事如意,
我aspx页面的的代码如下,有四个标题对应四个内容,只显示其中一个(初始设为显示content1),功能是:当点击一标题如 "发放记录 "(ID号为titel2)时,就显示,对应的(ID号为content2)DIV框,其它的div隐藏.CSS代码多我没列出(点击显示对应的DIV是没有问题的)。但我在content2里有个datagrid,要实现分页功能,问题就出来了,当显示content2时点下一页的时候,页面重新加载初始化了,就会把content1显示出来,而我想看的是content2的第二页内容.我想到的办法是在后台e.NewPageIndex时,把content2的className设置为显示(css里activecontent为显示,hiddencontent为隐藏)其它的DIV设为隐藏。那怎么在_PageIndexChanged事件里改变前台className呢???或者大家有别的方法吗??
<div   class= "searchmenu ">
    <ul   class= "title ">
    <li> <a   id= "title1 "   onclick   = "chang(1) "   href= "# "   class= "active "> 库存 </a> </li>
    <li> <a   id= "title2 "   onclick   = "chang(2) "   href= "# "> 发放记录 </a> </li>
    <li> <a   id= "title3 "   onclick   = "chang(3) "   href= "# "> 网点库存 </a> </li>
    <li> <a   id= "title4 "   onclick   = "chang(4) "   href= "# "> 出单记录 </a> </li>
                    </ul>
    <div   id= "content1 "   class= "activecontent ">
                                内容太多没例出1
    </div>
    <div   id= "content2 "   class= "hiddencontent ">
          <asp:DataGrid   ID= "dgShowInComeNote "   runat= "server "   AllowPaging= "True "   AutoGenerateColumns= "False "   OnPageIndexChanged= "dgShowInComeNote_PageIndexChanged "   PageSize= "18 ">
<PagerStyle   Font-Bold= "False "   Font-Italic= "False "   Font-Overline= "False "   Font-Strikeout= "False "   Font-Underline= "False "   HorizontalAlign= "Center "   />
      <Columns>
      <asp:BoundColumn   DataField= "icSource "   HeaderText= "来源 "> </asp:BoundColumn>
      <asp:BoundColumn   DataField= "insuType "   HeaderText= "类别 "> </asp:BoundColumn>
      <asp:BoundColumn   DataField= "icFromNum "   HeaderText= "起号 "> </asp:BoundColumn>
        <asp:BoundColumn   DataField= "icDate "   HeaderText= "接收日期 "> </asp:BoundColumn>
        </Columns>
</asp:DataGrid>
    </div>
    <div   id= "content3 "   class= "hiddencontent ">
                                内容太多没例出3
    </div>
    <div   id= "content4 "   class= "hiddencontent ">
                                内容太多没例出4
    </div>


------解决方案--------------------
你的代码太多太乱,没有看全。给你写个例子自己理解一下:

bool SubStateChanged=true;

int ShowContentNum