NEWBIE: problem populating a GridView
- From: "Jeff" <it_consultant1@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 13:52:05 +0100
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
.
- Follow-Ups:
- Re: NEWBIE: problem populating a GridView
- From: Jeff
- Re: NEWBIE: problem populating a GridView
- Prev by Date: SessionID Length
- Next by Date: Re: Page.Request Property With MasterPage
- Previous by thread: SessionID Length
- Next by thread: Re: NEWBIE: problem populating a GridView
- Index(es):
Relevant Pages
|
Loading