using (SPSite site=new SPSite(siteurl))
            {
                using(SPWeb web=site.OpenWeb())
                {
                    try
                    {
                        SPList list = web.Lists["ServiecesInfo"];
                        SPFieldChoice spcustomerlocation = new SPFieldChoice(list.Fields, "CustomerLocation");
                         for (int i = 0; i < spcustomerlocation.Choices.Count; i++)
                        {
                            ddlCustomLocation.Items.Add(new ListItem(spcustomerlocation.Choices[i].ToString(), i.ToString()));
                        }             
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }

相关文章:

  • 2021-11-25
  • 2021-07-15
  • 2021-05-26
  • 2021-06-26
  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2021-10-01
相关资源
相似解决方案