private List<string> GetListItems()
{
//string[] ListArr = { string.Empty };
List<string> list = null;
try
{
SPList lst = Web.Lists["ListName"];
SPListItemCollection lst_colls = lst.Items;
if (lst_colls.Count > 0)
{
list = new List<string>();
foreach (SPListItem Item in lst_colls)
{
if (!string.IsNullOrEmpty(Convert.ToString(Item["Title"])))
{
list.Add(Convert.ToString(Item["Title"]));
}
}
}
return list;
}
catch (Exception ex)
{
throw ex;
}
}
{
//string[] ListArr = { string.Empty };
List<string> list = null;
try
{
SPList lst = Web.Lists["ListName"];
SPListItemCollection lst_colls = lst.Items;
if (lst_colls.Count > 0)
{
list = new List<string>();
foreach (SPListItem Item in lst_colls)
{
if (!string.IsNullOrEmpty(Convert.ToString(Item["Title"])))
{
list.Add(Convert.ToString(Item["Title"]));
}
}
}
return list;
}
catch (Exception ex)
{
throw ex;
}
}
No comments:
Post a Comment