Assuming that you output the username in a control (e.g. Label or TextBox) in each RepeaterItem, you need to identify the control dynamically in the ItemCommand-event handler.
The following sample shows how you can access the control. It assumes that the UserName is displayed in a TextBox with the ID txtUserName
:
protected void rptrAdmUserList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
var txtUserName = e.Item.FindControl("txtUserName") as TextBox;
if (txtUserName != null)
{
string pnumber = txtUserName.Text;
lblseluser.Text = "Selected user is: " + pnumber;
}
}
You can use the other properties of the RepeaterCommandEventArgs parameter e
to identify the command that was fired.