日期:2014-05-17  浏览次数:20448 次

在ASP.net中怎么调整顺序呀
在ASP上有一表格,数据库有一整数字段"Sort"用来记录排序的前后,查询是通过"sort"排序,
在显示页面上点"向上",向下"可以调整顺序

<asp:GridView ID="gridView" runat="server" AllowPaging="True" 
        Width="100%" CellPadding="3"  OnPageIndexChanging ="gridView_PageIndexChanging"
                    BorderWidth="1px" DataKeyNames="id" OnRowDataBound="gridView_RowDataBound"
                    AutoGenerateColumns="False"  RowStyle-HorizontalAlign="Center" 
        OnRowCreated="gridView_OnRowCreated">
                    <Columns>
                    <asp:TemplateField ControlStyle-Width="30" HeaderText="选择"    >
                                <ItemTemplate>
                                    <asp:CheckBox ID="DeleteThis"  runat="server" onclick="javascript:CCA(this)" />
                                </ItemTemplate>

<ControlStyle Width="30px"></ControlStyle>
                            </asp:TemplateField> 
                            
<asp:BoundField DataField="Name" HeaderText="名称" SortExpression="Name" 
                            ItemStyle-HorizontalAlign="Center"  > 
<ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="排序" SortExpression="Sort">
                            <ItemTemplate>
                                <a href="#" onclick="moveUp(this)"  >
                                    向上</a> 
 &