Write an Article Write a Tutorial Add a Fast Code* *Fast Code might be any helpful code with brief comment
Stem Cells Blood Banks Insurances .Net Hosting Credit Cards PC Rental Business
Tutorials: ASP .NET C# .NET VB .NET Articles: ASP .NET C# .NET VB .NET Fast Code: ASP .NET C# .NET VB .NET
No online User
Now in the code behind create a DataView so later you can sort it according to LastLoginDate of the User.
public DataView GetAllUsersDataTable() { MembershipUserCollection mc = Membership.GetAllUsers(); DataTable dt = new DataTable("LastUsers"); dt.Columns.Add("UserName", typeof(string)); dt.Columns.Add("Ldate", typeof(DateTime)); foreach (MembershipUser st in mc) { if (st.IsOnline) dt.Rows.Add(new Object[] { st.UserName, st.LastLoginDate}); } dt.AcceptChanges(); DataView dv = new DataView(dt); return dv; }
On the Page Load event of the Page bind your Gridview to the created DataView.
DataView tView = GetAllUsersDataTable(); tView.Sort = "Ldate DESC"; GridView1.DataSource = tView; GridView1.DataBind();
Download the Code: CheckOnlineUsers.zip
ang galing
29/07/2007 21:12:10 UTC
01/08/2007 01:36:48 UTC
19/11/2007 10:27:21 UTC
16/04/2008 06:39:35 UTC
04/06/2008 21:33:02 UTC