如何对基于Gridview的会话值进行排序

时间:2014-04-04 06:43:55

标签: asp.net gridview gridview-sorting

如果我点击超链接到gridview按钮的值,我有一个带超链接的gridview。

protected void gvDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
    try
    {
        if (e.Row.DataItem != null)
        {
            // DataTable readDt = null;
            List<String> rows = null;
            //Fetching the List from Session Object
            if (Session["ReadJobDetails"] != null)
            {
                rows = (List<String>)Session["ReadJobDetails"];
            }
            if (rows.Contains(DataBinder.Eval(e.Row.DataItem, "JobTitle").ToString()))
            {
                //since we used GridView level CSS class, individual CSS class is not applying, so added manually
                //e.Row.BackColor = System.Drawing.Color.FromArgb(208, 217, 206);
                e.Row.BackColor = System.Drawing.Color.Silver;
                e.Row.ForeColor = System.Drawing.Color.White;
                e.Row.Font.Bold = false;                    
            }
            else
            {
                e.Row.BackColor = System.Drawing.Color.FromArgb(247, 247, 247);
                e.Row.ForeColor = System.Drawing.Color.Black;
                e.Row.Font.Size = 9;
                e.Row.Font.Bold = true;
            }
        }
        }
    catch (Exception)
    {
        throw;
    }

}

0 个答案:

没有答案