1
我排序網格視圖。排序工程perfect.Now我試圖添加排序箭頭旁邊每個標題列。我幾乎嘗試過所有方式,但箭頭沒有得到顯示在我的UI.PFB我的代碼:網格視圖排序箭頭沒有得到顯示
CSS:
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;
}
代碼背後:
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();
}
}
//排序邏輯已經基於濾波器applied.I 2個條件已經添加這裏只有第一個條件
GridView的標籤:
<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>
請幫助我。