i resolved my latest problem of accesing the active directory... since the same values are in my old project with the SQL database that's linked with the active directory but yeah... i have an error when i want to create an linkbutton array instead of a simple string list...
here is the code and where the error is located i narrowed it down as much as possible:
some people have this same bug with .net too...
[php]namespace FaceBook_app
{
public class FaceBook_Code : Microsoft.SharePoint.WebPartPages.WebPart
{
facebookDirectoryDataContext FBAccs = new facebookDirectoryDataContext();
public FaceBook_Code()
{
ACC = FBAccs.Badges;
Member = (from aws in ACC orderby aws.Bezoeker select aws).ToList();
//Test = new LinkButton[Member.Count];
}
protected override void CreateChildControls()//Problem #1 :: VAL = NULL @ <BR> (TRY/CATCH?)//#2 :: Object reference not set to an instance of an object. = (!no button eventhandler, Crashes when 1 codeline gets filled in, curently null entry?)
{
/*
try
{*/
LinkButton[] Test = new LinkButton[Member.Count];
for (int i = 0; i <= this.Member.Count - 1; i = i + 2)
{
Test[i].Click += new EventHandler(Test_Click);
Test[i].Text = Member[i].Bezoeker;
this.Controls.Add(Test[i]);
if (i + 1 < Member.Count)
{
Test[i].Text = Member[i].Bezoeker;
Test[i+1].Click += new EventHandler(Test_Click);
this.Controls.Add(Test[i + 1]);
}
else
{
try{}
catch(Exception a)
{
writa.WriteLine(a);
}
}
}/*
}
catch (*********enceException nre)
{
this code works without any request for an button and without the childcontrolls. > childcontrols is the first line it fails.. says its NULL?? I added an Field == null statement... i now obtained the error:
[UnsafeControlException: Een webonderdeel of besturingselement voor een webformulier op deze pagina kan niet worden weergegeven of geïmporteerd. Het type is niet gevonden of staat niet als veilig geregistreerd.]
at Microsoft.SharePoint.ApplicationRuntime.SafeContro ls.GetTypeFromGuid(Guid guid)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager .CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
English:
[UnsafeControlException: An webpart or controlelement for an webform on this page can not be showed or imported. The type isn't found or isn't registered as safe.]
at Microsoft.SharePoint.ApplicationRuntime.SafeContro ls.GetTypeFromGuid(Guid guid)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager .CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)