How to call:-
if (constantHashTable == null)
{
constantHashTable = CommonMethods.GetKeyElementValues(); }
Function:-
public static Hashtable GetKeyElementValues()
{
Hashtable hashTable = new Hashtable();
try
{
SPList constantList;
constantList = SPContext.Current.Web.Lists.TryGetList("AC_BVConstants");
if (constantList != null) {
SPListItemCollection listIemCollection = constantList.GetItems();
if (listIemCollection != null)
{
if (listIemCollection.Count > 0) {
foreach (SPListItem spLstItem in listIemCollection)
{
hashTable.Add(spLstItem["Key"], spLstItem["Value"]);
}
} }
} }
catch (Exception ex)
{
throw ex;
}
return hashTable;
}
How to use
Convert.ToString(constantHashTable["Msg_NoData"], CultureInfo.InvariantCulture);
if (constantHashTable == null)
{
constantHashTable = CommonMethods.GetKeyElementValues(); }
Function:-
public static Hashtable GetKeyElementValues()
{
Hashtable hashTable = new Hashtable();
try
{
SPList constantList;
constantList = SPContext.Current.Web.Lists.TryGetList("AC_BVConstants");
if (constantList != null) {
SPListItemCollection listIemCollection = constantList.GetItems();
if (listIemCollection != null)
{
if (listIemCollection.Count > 0) {
foreach (SPListItem spLstItem in listIemCollection)
{
hashTable.Add(spLstItem["Key"], spLstItem["Value"]);
}
} }
} }
catch (Exception ex)
{
throw ex;
}
return hashTable;
}
How to use
Convert.ToString(constantHashTable["Msg_NoData"], CultureInfo.InvariantCulture);
No comments:
Post a Comment