private void GetDataTablefenye()
{
string srotexp = string.Empty;
if (ViewState["sortexp"] != null)
{
Dictionary<string, string> dic = (Dictionary<string, string>)ViewState["sortexp"];
foreach (KeyValuePair<string, string> keyvalue in dic)
{
srotexp += "," + keyvalue.Key + " " + keyvalue.Value;
}
srotexp = srotexp.Substring(1);
}
ArticleInfo article = new ArticleInfo();
this.GridView1.DataSource = article.GetDataTablefenye(Convert.ToInt32(ViewState["pageindex"]),pagesize,srotexp);
this.GridView1.DataBind();
}
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
if (ViewState["sortexp"] == null)
{
dic.Add(e.SortExpression, "ASC");
ViewState["sortexp"] = dic;
}
else
{
dic = (Dictionary<string, string>)ViewState["sortexp"];
if (dic.ContainsKey(e.SortExpression))
{
if (dic[e.SortExpression] == "ASC")
{
dic[e.SortExpression] = "DESC";
}
else
{
dic[e.SortExpression] = "ASC";
}
ViewState["sortexp"] = dic;
}
else
{
dic.Clear();
dic.Add(e.SortExpression, "ASC");
ViewState["sortexp"] = dic;
}
}
GetDataTablefenye();
}