将用户名显示在仪表板文本框中 [英] Displayer UserName to a dashboard textbox

查看:73
本文介绍了将用户名显示在仪表板文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示登录其他用户的用户名。

解决方案

在您的解决方案中添加课程







如下:



使用报表;



class用户

{

公共静态字符串UserName =;

public User()< br $>
{

}

}





然后在登录时点击

如果登录成功但转移到其他页面之前



创建用户类对象为:





用户Uid =新用户();

Uid.UserName = UserName.Text;

//UserName.Text是用户文本框







然后在仪表板上加载

再次创建用户类的对象

并将UserName分配如下:





用户Uid =新用户();

DashboardTextbox.Text = Uid.UserName;


如果它是一个Web应用程序,那么请执行以下操作





1 。当用户登录时将用户名的值分配给会话

2.在仪表板加载时将该会话值分配给文本框文本


HttpContext.Current.User.Identity.Name;

How do I display the name of a user who logged in to another.

解决方案

add class in your solution



as below:

Using statements;

class User
{
public static string UserName="";
public User()
{
}
}


then at time of loggin click
if loggin successfully but before transferring to other page

create user class Object as:


User Uid=new User();
Uid.UserName=UserName.Text;
//UserName.Text is the user Text Box



then at the time of dash board loading
again create the object of User Class
and assign the UserName as Below:


User Uid=new User();
DashboardTextbox.Text=Uid.UserName;


if it is an web application then do as follow


1. as the user logged in assign the value of user name to session
2. at the time of dashboard loading assign that session value to textbox text


HttpContext.Current.User.Identity.Name;


这篇关于将用户名显示在仪表板文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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