首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >网格视图排序箭头未显示

网格视图排序箭头未显示
EN

Stack Overflow用户
提问于 2016-12-30 12:13:20
回答 0查看 861关注 0票数 1

我正在对网格进行排序view.The排序工作perfect.Now我正在尝试将排序箭头添加到每个标题列旁边。我尝试了几乎所有的方法,但箭头不显示在我的UI.PFB中我的代码:

CSS:

代码语言:javascript
复制
th .ascending a {
    background: url(images/ascArrow.gif) no-repeat;
    display: block;
    padding: 0 4px 0 15px;
}

th .descending a {
    background: url(images/descArrow.gif) no-repeat;
    display: block;
    padding: 0 4px 0 15px;
}

代码隐藏:

代码语言:javascript
复制
protected void RPMData_Sorting(object sender, GridViewSortEventArgs e)
    {
        if (TextData.Text == String.Empty)
        {
            SqlCommand cmd = new SqlCommand("select Customer_Name,Site_Type,Source,Destination,Latency,Jitter_Priority_Real_Time,Jitter_Real_Time,PacketLoss_Priority_Real_Time,PacketLoss_Real_Time,PacketLoss_Other_Classes from RPM", con);
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt1);
            con.Close();
            if (dt1.Rows.Count > 0)
            {
                string sortingDirection = string.Empty;
                if (direction == SortDirection.Ascending)
                {
                    direction = SortDirection.Descending;
                    RPMData.HeaderStyle.CssClass = "descending";
                    sortingDirection = "Desc";
                }
                else
                {
                    direction = SortDirection.Ascending;
                    RPMData.HeaderStyle.CssClass = "ascending";
                    sortingDirection = "Asc";
                }

                DataView sortedView = new DataView(dt1);
                sortedView.Sort = e.SortExpression + " " + sortingDirection;
                Session["SortedView"] = sortedView;
                RPMData.DataSource = sortedView;
                RPMData.DataBind();
            }
        }

//根据应用的过滤器,排序逻辑有两个条件。我在这里只添加了第一个条件

GridView标签:

代码语言:javascript
复制
<asp:GridView CssClass="infoTable" ID="RPMData" runat="server" OnSelectedIndexChanged="Button1_Click" AllowPaging="True" PageSize="10" OnPageIndexChanging="RPMData_PageIndexChanging" AllowSorting="True" OnSorting="RPMData_Sorting" AutoGenerateColumns="False" SortedAscendingHeaderStyle-CssClass="ascending" SortedDescendingHeaderStyle-CssClass="descending">
    <HeaderStyle CssClass="ascending" />
        <Columns>

请帮帮我。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41390519

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档