Code //设置按钮样式 for (int i =0; i < DataList1.Items.Count;i++ ) { foreach (Control c in DataList1.Items[i].Controls) { if (c is LinkButton) { LinkButton lb = (LinkButton)c; if(lb.ToolTip==Session["Module"].ToString()) DataList1.Items[i].CssClass ="main_menu_selected"; } } }