Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one registration page in page some fields is there name,password,city and many more after registration page completed when user log in to see only own records not to see other records how to do that

C#
protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (HttpContext.Current.Session["UserDetails"] != null)
                {
                    DataTable dtUserName = (DataTable)HttpContext.Current.Session["UserDetails"];
                    lblUserName.Text = Convert.ToString(dtUserName.Rows[0]["Name"]);
                    string userRole = Convert.ToString(dtUserName.Rows[0]["RoleName"]);
                    if (userRole.Equals("User"))
                    {

                        Response.Write("Welcome Mr User" + ":" + lblUserName.Text);
                        //BindUserGrid(null);
                    }
                }
                else
                {
                    Response.Redirect("~/Signout.aspx");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Posted
Updated 5-Apr-15 23:58pm
v2
Comments
deepankarbhatnagar 6-Apr-15 5:45am    
PLease explain clearly & provide code too
[no name] 6-Apr-15 5:50am    
use primary key,then display the userid details only in grid view

 
Share this answer
 
 
Share this answer
 

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