JQGrid 値を並べ替えようとすると、NullReferenceException was unhandled by user code 例外が発生します。
public ActionResult GetSearch(string sidx, string sord, int page, int rows)
{
if (sidx != "")
{
//In the Session["ResourceSearch"] I have loaded the values
DataContractClass[] SortResult = Session["ResourceSearch"] as DataContractClass[];
//Sort the JQGrid value from input 'sidx'
SortResult = SortResult.OrderBy(p => p.GetType().GetProperty(sidx).GetValue(p, null)).ToArray() as DataContractClass[];
//Load data here
}
}
への入力としての int プロパティの場合にのみ問題に直面しています。しかしsidx
、文字列プロパティが問題にならない場合はsidx
、データをソートできます。