日期:2014-05-16 浏览次数:20485 次
<asp:GridView ID="gvHeader" runat="server" AllowSorting="True" AutoGenerateColumns="False" > <HeaderStyle CssClass="gvHeader" /> <Columns> <asp:BoundField HeaderText="序号"> <HeaderStyle Width="30" /> </asp:BoundField> <asp:BoundField HeaderText="编码" SortExpression="ShowCode"> <HeaderStyle Width="100" /> </asp:BoundField> <asp:BoundField HeaderText="名称" SortExpression="MName"> <HeaderStyle Width="300" /> </asp:BoundField> </Columns> </asp:GridView>
<table cellspacing="0" rules="all" border="1" id="gvHeader" style="border-collapse: collapse;"> <tr class="gvHeader"> <th scope="col" style="width: 30px;"> 序号 </th> <th title="点击对<分类编码>进行排序" scope="col" style="width: 100px;"> <a href="javascript:__doPostBack('gvHeader','Sort$ShowCode')">分类编码</a> </th> <th title="点击对<名称>进行排序" scope="col" style="width: 300px;"> <a href="javascript:__doPostBack('gvHeader','Sort$MName')">名称</a> </tr> </table> <script> var width = document.getElementsByTagName("th"); alert(width.length); </script>
------解决方案--------------------
<table cellspacing="0" rules="all" border="1" id="gvHeader" style="border-collapse: collapse;"> <tr class="gvHeader"> <th scope="col" style="width: 30px;"> 序号 </th> <th title="点击对<分类编码>进行排序" scope="col" style="width: 100px;"> <a href="javascript:__doPostBack('gvHeader','Sort$ShowCode')">分类编码</a> </th> <th title="点击对<名称>进行排序" scope="col" style="width: 300px;"> <a href="javascript:__doPostBack('gvHeader','Sort$MName')">名称</a> </tr> </table> <script> var width = document.ge