8
Answers

Image button problem.

Photo of Vikas Ahlawat

Vikas Ahlawat

14y
3.2k
1
I m using image button on my webpage

   <asp:ImageButton ID="ImageButton1" runat="server"
                                ImageUrl="~/Images/Button/Button-Home.gif" onclick="ImageButton1_Click"
                                OnMouseOver="this.src='Images/Button/Button-Home2.gif'"
    onmouseout="this.src='Images/Button/Button-Home.gif'"
                                 />

By the above code i can able to chage image (Button-Home.gif   to   Button-Home2.gif )

Now my problem is that i want to fix image (Button-Home2.gif) fix if i click on the image button.
How can i do this?

Answers (8)

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