Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

spfield

$
0
0
                 SPWeb mysite = SPContext.Current.Web;
                SPList mylists = mysite.Lists["LOKESH CUSTOM LIST"];
                SPField spfield = mylists.Fields["GroupNames"];
                SPGroupCollection userinallgroups = SPContext.Current.Web.CurrentUser.Groups;
                SPListItemCollection items = mylists.Items;
                if (mylists != null)
                {       
                    foreach (SPListItem Item in items)
                    {
                        foreach (SPGroup grp in userinallgroups)
                        {   
                            SPUserCollection usercollection = grp.Users;
                            string groupname = grp.Name.ToString();
                            
                            if (Item["GroupNames"].ToString() == groupname)
                            {
                                LiteralControl myitems = new LiteralControl();
                                myitems.Text = Item["Title"].ToString();
                                this.Controls.Add(myitems);
                            }
                        }
                    }
                }

if the field is choice the output what i want is getting properly but if i change the field value to multichoice field  i am not getting the desired result can anyone help me in this? please 


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>