当我登录在网格视图中显示我的特定数据 [英] When I Login Show My Specific Data In Grid View

查看:75
本文介绍了当我登录在网格视图中显示我的特定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面中有一个注册页面有些字段有名称,密码,城市等等,注册页面完成后用户登录时只能查看自己的记录而不看其他记录怎么做



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

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;
            }
        }

推荐答案





参考:如何展示仅在ASP.Net中的GridView中登录用户详细信息


检查出来: ASP.NET身份简介 [ ^ ]


这篇关于当我登录在网格视图中显示我的特定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆