5
Answers

Changing Label's Text

Photo of Pal

Pal

16y
4.8k
1

Hi! It may seems easy but since I am learning I would like to know How I can change text of Lable.

I have RadioButtonList(rbl1 and rbl2) and Label1 and when someone click on rbl2, how i can change text of Label1. Also, I have set rbl1 as default selected. So when somone click back to rbl1, the default text of Label1 should be appearing.

Thanks for your answer.

R Patel

Answers (5)

0
Photo of Altaf Ansari
NA 1.4k 27.4k 7y
Hello Ravi, Please store the user Detail in DataBase specially ID which is generated by HUB, with respective Users..
 
 
And Check each time while user login the application..
 
 
  1. public void Connect(string userName)  
  2.         {  
  3.             var id = Context.ConnectionId;  
  4.   
  5.             // Getting ID from DataBase if Exist  
  6.             string LoginId = ConnC.GetColumnVal("Select LoginId from Users Where UserName='" + userName + "'""LoginId");  
  7.   
  8.             if (LoginId == null || LoginId != ""// Updating ID in DataBase if Not Exist  
  9.                 ConnC.ExecuteQuery("Update Users set LoginId='"+ id + "' where UserName='" + userName + "'");  
  10.   
  11.             if (ConnectedUsers.Count(x => x.ConnectionId == id) == 0)  
  12.             {  
  13.                 string UserImg = GetUserImage(userName);  
  14.                 string logintime = DateTime.Now.ToString();  
  15.   
  16.                 if (LoginId != id)  
  17.                     ConnectedUsers.Add(new Users { ConnectionId = id, UserName = userName, UserImage = UserImg, LoginTime = logintime });  
  18.                 // send to caller  
  19.                 Clients.Caller.onConnected(id, userName, ConnectedUsers, CurrentMessage);  
  20.   
  21.                 // send to all except caller client  
  22.                  
  23.                     Clients.AllExcept(id).onNewUserConnected(id, userName, UserImg, logintime);  
  24.             }  
  25.         }