Not sure if I am understanding your problem correctly. But, assuming you have a menu control, and it is dynamically populated items menu with the document name, you can do sty like this:
You can set the MenuItemClick event of the Menu from the properties window. Then in the code behind, you can do sth like:
protected void Menu1_MenuItemClick(Object sender, System.Web.UI.WebControls.MenuEventArgs e)
{
string documentName = e.Item.Value;
}