J
Jeff
ASP.NET 2.0
I have a GridView control in my webpage. In this GridView's
gridUsers_RowDataBound am I having problem populating the controls with info
from the datasource -
This code is the problem:
MembershipUser user = (MembershipUser)e.Row.DataItem;
The user object doesn't get a MembershipUser value, it gets the value NULL.
Here are some of the code from my webpage so can get an overview of what I'm
doing:
<asp:GridView ID="gridUsers"
runat="server"
AutoGenerateColumns="false"
OnRowDataBound="gridUsers_RowDataBound" >
protected void Page_Load(object sender, EventArgs e)
{
MembershipUserCollection allUsers = Membership.GetAllUsers();
gridUsers.DataSource = allUsers;
gridUsers.DataBind();
}
protected void gridUsers_RowDataBound(object o, GridViewRowEventArgs e)
{
MembershipUser user = (MembershipUser)e.Row.DataItem; **** < this code
don't work
ProfileCommon userProfile = Profile.GetProfile(user.UserName);
/*
Here I will put code that manually populate the columns in the
GridView with info from the Profile object
*/
}
any suggestions on what I should do to populate the user object with the
MembershipUser value?
Jeff
I have a GridView control in my webpage. In this GridView's
gridUsers_RowDataBound am I having problem populating the controls with info
from the datasource -
This code is the problem:
MembershipUser user = (MembershipUser)e.Row.DataItem;
The user object doesn't get a MembershipUser value, it gets the value NULL.
Here are some of the code from my webpage so can get an overview of what I'm
doing:
<asp:GridView ID="gridUsers"
runat="server"
AutoGenerateColumns="false"
OnRowDataBound="gridUsers_RowDataBound" >
protected void Page_Load(object sender, EventArgs e)
{
MembershipUserCollection allUsers = Membership.GetAllUsers();
gridUsers.DataSource = allUsers;
gridUsers.DataBind();
}
protected void gridUsers_RowDataBound(object o, GridViewRowEventArgs e)
{
MembershipUser user = (MembershipUser)e.Row.DataItem; **** < this code
don't work
ProfileCommon userProfile = Profile.GetProfile(user.UserName);
/*
Here I will put code that manually populate the columns in the
GridView with info from the Profile object
*/
}
any suggestions on what I should do to populate the user object with the
MembershipUser value?
Jeff