check current user belog to whcich group in List Of Grops in A list Column
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb objWeb = site.OpenWeb())
{
SPList oList = objWeb.Lists["Kaizen Category"];
SPListItemCollection results = oList.GetItems();
foreach (SPListItem item in results)
{
string group = item["Category"].ToString();
SPGroup groupName = SPContext.Current.Web.Groups[group];////.Split('#')[1]
SPUser user = objWeb.EnsureUser(objWeb.CurrentUser.ToString());
if (groupName.ContainsCurrentUser)
{
divDrop.Visible = true;
}
}
}
}
Comments