-1
我正在使用此特定系統。在管理頁面,當然作爲管理員,他可以查看系統的所有用戶。要查看所有用戶,我使用此代碼以檢索db中的所有用戶。檢索除管理員以外的所有用戶名
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridview();
}
}
protected void BindGridview()
{
gvDetails.DataSource = Membership.GetAllUsers();
gvDetails.DataBind();
}
現在的問題是,網格視圖顯示所有的用戶和管理員。我如何防止gridview顯示管理員的電子郵件和用戶名?
謝謝。
謝謝。但它給了我這個錯誤:無法找到源類型'System.Web.Security.MembershipUserCollection'的查詢模式的實現。 '找不到'。考慮明確指定範圍變量'user'的類型。 – 2012-03-01 03:50:02
查詢應該來自Membership.GetAllUsers()中的MembershipUser用戶//參考:http://sqlblogcasts.com/blogs/simons/archive/2009/01/15/Using-LINQ-with-unfriendly-collections.aspx – MatthewMartin 2012-10-26 17:54:53