1

我有一个gridview并且我正在尝试绑定数据:

string id = Request.QueryString["uid"].ToString();

MembershipUser u = Membership.GetUser(new Guid(id)); 

GridView1.DataSource = Membership.GetUser(u.ProviderUserKey); 

GridView1.DataBind();

我收到一个错误:

Data source is an invalid type.  It must be either an IListSource,
IEnumerable, or IDataSource.

但我试过:

GridView1.DataSource = Membership.GetAllUsers();

上面的代码ok

我如何gridview通过ProviderUserKey类似字符串将数据绑定到

4

1 回答 1

0
GridView1.DataSource = Membership.GetAllUsers();
GridView1.DataBind();

必须工作:http: //msdn.microsoft.com/en-us/library/dy8swhya.aspx

检查你的语法,你最后没有“ s ”字母。

Membership.GetAllUser s ();

于 2013-01-02T14:09:28.470 回答