Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
I am reading user types like below it is giving me following error
The type initializer for 'umbraco.BusinessLogic.UserType' threw an exception.
dt = new DataTable(); dt.Columns.Add(new DataColumn("UserTypeText",typeof(string))); dt.Columns.Add(new DataColumn("UserTypeID",typeof(string))); DataRow dr; dr = dt.NewRow(); dr["UserTypeText"] = "Please select type"; dr["UserTypeID"] = "0"; dt.Rows.Add(dr); List<UserType> userTypes = UserType.GetAllUserTypes();--------------> Here i am getting Error foreach (UserType userTypeText in userTypes) { dr = dt.NewRow(); if (userTypeText.Name.ToString().IndexOf("WCMS.") != 0) { dr["UserTypeText"] = userTypeText.Name.ToString(); dr["UserTypeID"] = userTypeText.Id.ToString(); dt.Rows.Add(dr); } } return dt; }
---vijay.
Stack traces are generally useful. But my assumption is that you're missing one or more references.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to read User Types?
Hi all,
I am reading user types like below it is giving me following error
The type initializer for 'umbraco.BusinessLogic.UserType' threw an exception.
dt = new DataTable();
dt.Columns.Add(new DataColumn("UserTypeText",typeof(string)));
dt.Columns.Add(new DataColumn("UserTypeID",typeof(string)));
DataRow dr;
dr = dt.NewRow();
dr["UserTypeText"] = "Please select type";
dr["UserTypeID"] = "0";
dt.Rows.Add(dr);
List<UserType> userTypes = UserType.GetAllUserTypes();--------------> Here i am getting Error
foreach (UserType userTypeText in userTypes)
{
dr = dt.NewRow();
if (userTypeText.Name.ToString().IndexOf("WCMS.") != 0)
{
dr["UserTypeText"] = userTypeText.Name.ToString();
dr["UserTypeID"] = userTypeText.Id.ToString();
dt.Rows.Add(dr);
}
}
return dt;
}
---vijay.
Stack traces are generally useful. But my assumption is that you're missing one or more references.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.