'system.data.dataview.dataview(system.data.datatable)'的最佳重载方法匹配有一些无效的参数 [英] The best overloaded method match for 'system.data.dataview.dataview(system.data.datatable)' has some invalid arguments
本文介绍了'system.data.dataview.dataview(system.data.datatable)'的最佳重载方法匹配有一些无效的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试按列对网格视图进行排序时
i使用排序方法进行排序但显示错误任何人都可以帮助我帮助
我尝试过:
As I am trying to sort the grid view by column
i have used sorting method to sort but shows error can anyone help help me
What I have tried:
public SortDirection dir
{
get
{
if (ViewState["dirstate"] == null)
{
ViewState["dirstate"] = SortDirection.Ascending;
}
return (SortDirection)ViewState["dirstate"];
}
set
{
ViewState["dirstate"] = value;
}
}
protected void gvDetails_Sorting(object sender, GridViewSortEventArgs e)
{
string sortingDirection = string.Empty;
if (dir == SortDirection.Ascending)
{
dir = SortDirection.Descending;
sortingDirection = "Desc";
}
else
{
dir = SortDirection.Ascending;
sortingDirection = "Asc";
}
DataView sortedView = new DataView(dt.gridview());
sortedView.Sort = e.SortExpression + " " + sortingDirection;
gvDetails.DataSource = sortedView;
gvDetails.DataBind();
}
推荐答案
错误消息说DataView构造函数没有接受的重载版本一个参数,它是一个GridView类实例
它有重载,不接受任何参数,DataTable,或DataTable和一些过滤器信息: DataView类(System.Data) [ ^ ]但它无法接受GridView。
可能你想传递DataTabledt
,但这是你的应用,不是我的,我不能确定。
The error message is saying "The DataView constructor does not have an overloaded version which accepts a single parameter which is a GridView class instance"
It has overloads which accept no parameters, a DataTable, or a DataTable and some filter info: DataView Class (System.Data)[^] but it can't accept a GridView.
Probably, you want to pass the DataTabledt
, but it's your app, not mine and I can't be sure.
这篇关于'system.data.dataview.dataview(system.data.datatable)'的最佳重载方法匹配有一些无效的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文