获取查阅项的ID及值部分
Code
/// <summary>
/// 从查阅项字符串中取出ID部分
/// </summary>
/// <param name="lookupFieldString"></param>
/// <returns></returns>
public static int GetLookupId(string lookupFieldString)
{
if (string.IsNullOrEmpty(lookupFieldString))
return 0;
string idString = lookupFieldString.Substring(0, lookupFieldString.IndexOf(";#"));
return int.Parse(idString);
}
/// <summary>
/// 从查阅项字符串中取出值部分
/// </summary>
/// <param name="lookupFieldString"></param>
/// <returns></returns>
public static string GetLookupValue(string lookupFieldString)
{
if (string.IsNullOrEmpty(lookupFieldString))
return null;
return lookupFieldString.Substring(lookupFieldString.IndexOf(";#")+2);
}
/// <summary>
/// 从查阅项字符串中取出ID部分
/// </summary>
/// <param name="lookupFieldString"></param>
/// <returns></returns>
public static int GetLookupId(string lookupFieldString)
{
if (string.IsNullOrEmpty(lookupFieldString))
return 0;
string idString = lookupFieldString.Substring(0, lookupFieldString.IndexOf(";#"));
return int.Parse(idString);
}
/// <summary>
/// 从查阅项字符串中取出值部分
/// </summary>
/// <param name="lookupFieldString"></param>
/// <returns></returns>
public static string GetLookupValue(string lookupFieldString)
{
if (string.IsNullOrEmpty(lookupFieldString))
return null;
return lookupFieldString.Substring(lookupFieldString.IndexOf(";#")+2);
}