filter users records according to user id in a dropdown

Posted by Jopito under ASP.NET on 12/16/2013 | Points: 10 | Views : 1175 | Status : [Member] | Replies : 2
Hellow friends,i have got an application where by a Super Student can add other lists of students with his user ID,.i have roles where by if one is in role of students,when logged in he can see also list of what was added by other "Super Student",What i need to do filter what each super student has to view,I.e Each should only view the records he added according to his ID,How i like to do it is check the user Id of currently logged in user ,and only let him view his records which are being populated in a dropdown combobox.Someone guide me about this.
Thanks

Mark as answer if satisfied


Responses

Posted by: Bandi on: 12/16/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
could you please post the table structure how you have this relation? explain clearly

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jopito on: 12/16/2013 [Member] Starter | Points: 25

Up
0
Down
Each super student has a Unique ID,this super student can insert records using his iD too.when he logs in,their is a dropdown whereby it has a list of other super students in that role of Staff,He can select any item in the dropdown i.e other super student and he will see the list of items of that particular Super student.Am getting the StudentId by this code MembershipUser user = Membership.GetUser(Page.User.Identity.Name);
int StudentId = manageStudents.GetStudentId((Guid)user.ProviderUserKey);
This is the StudentID the super student adds records.

public int GetStudentId(Guid studentId)
{
try
{
return db.Students.FirstOrDefault(x => x.UseId == studentId).StudentId;

}
catch (Exception)
{

throw;
}

On loggin in ,the dropdowns are populating data according to the selected item,I need to restrict it such that on logging in,the ID of the currently logged in user is tracked such that what is in the dropdown is data which was added using that paricular id.

I have a table called Students whereby StudentID is the foreign Key to the table called Adminstrators where AdminstratorId is the Primary Key
Each of Adminstrators can have several "super students" and this super students can add now new records of student using their Ids,

Mark as answer if satisfied

Jopito, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response