C# Technical
Check Integer only.
if (int.TryParse(Convert.ToString(dr[Constants.Meetings]), out IntergerValue))
{
int itnergervalue;
}
Get String value from List by ID
public string GetFunName(string ID)
{
string userID = string.Empty;
string[] splitEmail = null;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite spsite = new SPSite(SPContext.Current.Site.Url))
{
using (SPWeb spWeb = spsite.OpenWeb())
{
if (Common.isListExists(spWeb, SharePointLists.MeetingInformation))
{
spList = spWeb.Lists[SharePointLists.MeetingInformation];
if (spList != null && spList.ItemCount > 0)
{
spListItem = spList.GetItemById(Convert.ToInt32(ID));
if (spListItem != null)
{
splitEmail = Convert.ToString(spListItem[ListColumnNames.Email]).Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries);
if (splitEmail.Length > 0)
userID = splitEmail[1];
}
}
}
else
throw new Exception(string.Format(JLTemplates.listNotFound, SharePointLists.MeetingInformation, spWeb.Title));
}
}
});
}
catch (Exception exception)
{
throw exception;
}
return userID;
}
get Datatable value
if (int.TryParse(Convert.ToString(dr[Constants.Meetings]), out IntergerValue))
{
int itnergervalue;
}
Get String value from List by ID
public string GetFunName(string ID)
{
string userID = string.Empty;
string[] splitEmail = null;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite spsite = new SPSite(SPContext.Current.Site.Url))
{
using (SPWeb spWeb = spsite.OpenWeb())
{
if (Common.isListExists(spWeb, SharePointLists.MeetingInformation))
{
spList = spWeb.Lists[SharePointLists.MeetingInformation];
if (spList != null && spList.ItemCount > 0)
{
spListItem = spList.GetItemById(Convert.ToInt32(ID));
if (spListItem != null)
{
splitEmail = Convert.ToString(spListItem[ListColumnNames.Email]).Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries);
if (splitEmail.Length > 0)
userID = splitEmail[1];
}
}
}
else
throw new Exception(string.Format(JLTemplates.listNotFound, SharePointLists.MeetingInformation, spWeb.Title));
}
}
});
}
catch (Exception exception)
{
throw exception;
}
return userID;
}
get Datatable value
dt.Rows[0]["column name"].ToString();
Comments
Post a Comment