LinkButton eventhandler i WebControl bliver ikke kaldt
Har et virkelig irriterende problem med at kalde en eventhandler på en LinkButton. Min kode ser sådan her udprotected override void CreateChildControls()
{
base.CreateChildControls();
Controls.Clear();
canvas = (WebPart1)HttpContext.Current.Session["canvas"];
switch (type)
{
case "TextFile":
{
break;
}
case "Folder":
{
for (int i = 0; i < fo.getFolderItemAL().Count; i++)
{
FolderItem tempFoI = (FolderItem)fo.getFolderItemAL()[i];
LinkButton link = new LinkButton();
link.ID = tempFoI.getFolderItemID().ToString();
link.Text = tempFoI.getFolderItemName();
string itemType = tempFoI.getFolderItemType();
link.CommandArgument = "" + tempFoI.getId();
link.OnClientClick += new EventHandler(this.navigateTextFile);
this.Controls.Add(link);
}
break;
}
case "Case":
{
}
break;
}
}
ChildControlsCreated = true;
}
public void navigateTextFile(object sender, EventArgs e)
{
DockableObject dockableObject = new DockableObject();
TextFileMapper tfmpp = new TextFileMapper();
LinkButton lbtn = (LinkButton)sender;
TextFile tempTextFile = (TextFile)tfmpp.getTextFile(System.Convert.ToInt32(lbtn.CommandArgument));
int id = tempTextFile.getTextFileID();
string type = tempTextFile.getType();
dockableObject.sendToCommand(type, id);
}
Problemet er at ovenstående eventhandler aldrig bliver kaldt. Mine links forsvinder bare og andet sker der ikke.