Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2010, 01:18 AM
Registered User
 
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display data of logged in user?

Imar, I'm struggling to figure out how to display data (from a sql server database) specific to the logged in user. I've setup up the login control and used WSAT to setup the users. Your help would be greatly appreciated. I've looked many places to find out how to do this. Your book has been outstanding for me to learn ASP.net.
 
Old April 19th, 2010, 02:25 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

When yoou're using EF and have a query in Code Behind, you can use Context.User.Name to find out the current user and use that in a where clause.

E.g.:

Code:
 
var whatever = from s in someDataSource
                      where s.UserName == Context.User.Name
                      select s
For tor the other controls, this search may help: http://www.google.com/#hl=en&q=conte...10401dfb0a78c2

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 20th, 2010, 05:46 AM
Registered User
 
Join Date: Apr 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default thanx

thanx aloooooooooooooot





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying data based on user logged in Spider Visual Web Developer 2008 23 May 19th, 2010 01:44 PM
user logged jonyBravo Access 6 November 27th, 2006 09:14 AM
Getting the name of the logged on user Grahame2003 C# 2 March 4th, 2004 04:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.