Profilemanager管理类的应用

ProfileManager与ProfileBase类相同,在使用ProfileManager时一定记得引用System.web.profile名字空间.该类主要用于管理用户配置属性\搜索用户配置属性,以及删除不再使用的用户配置\更新等等.

1\读取所有PROFILE用户信息
    
程序代码 程序代码
GridView1.DataSource = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All);
        GridView1.DataBind();



2\该ProfileInfo对象集合是由 ProfileManager的GetAllProfiles方法获得的。当你点击GridView1中的任意一行的Select链接时,你将会看到该用户的自定义基本资料表;

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        ProfileCommon SelectedProfile = Profile.GetProfile(GridView1.SelectedValue.ToString());
        TextBox1.Text = SelectedProfile.QQ;
        TextBox2.Text = SelectedProfile.msn;
    }

3\DataKeyNames 属性指定数据键  早上测试时就漏了这个关键字导致无法正常显示这里的DataKeyNames=UserName

详细的源码将在后面上传给大家下载参考
原文地址:https://www.cnblogs.com/Bany/p/1755483.html