Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a log in page and a gridview page , where when the user login in , they would be able to see what they have booked and they should not be able to see rooms that are booked by other people.

What I have tried:

i tried using session key but it doesnt seems to work.
Latest... although still not working... im still trying to figure out why..
if (!IsPostBack)
           {
               string sql = "Select * from Meeting where staff_id={0}";
               GvBooking.DataSource = DBUtl.GetTable(sql,Session["staff_id"]);
               GvBooking.DataBind();
           }

But it doesnt work..
Posted
Updated 21-Jan-18 20:50pm
v3
Comments
an0ther1 21-Jan-18 18:09pm    
Short answer is yes, but how depends on many factors.
The easiest way is dependent on what your data looks like & how you authenticate the user - their login details should be available to your code behind but via what is dependent on authentication method.
Improve your question - add detail regarding the data & how the user is authenticated

Kind Regards
Dotnet_Dotnet 22-Jan-18 1:49am    
sir l think the varchar field
may not be taken within single code
dibdab 22-Jan-18 2:51am    
Hi, I recently updated my code.. although it still doesnt work, i am still trying to figure out why.
F-ES Sitecore 22-Jan-18 4:17am    
Does Session["staff_id"] contain the correct id as you would expect?
dibdab 22-Jan-18 4:44am    
yup.. it is an id from the database , as well as the id where the user logs in with

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900