I have an issue with LinkButton in my toolbar, basically i deployed a custom action which adds a link button to the menu, this link button on click should do some task like adding an item, but this method is never called.
That is how the code looks like for the link button:
public class MyCustomControl: WebControl
{
protected override void CreateChildControls()
{
base.CreateChildControls();
LinkButton linkButton = new LinkButton
{
Text="Fun"
};
linkButton.Click += new EventHandler(linkButton_Click);
Controls.Add(linkButton);
}
void linkButton_Click(object sender, EventArgs e)
{
//DO SOME ACTIOn
}
}
So the linkbutton is added and everything is ok, but when i click it, it just refreshes the page and that is it. Nothing happens
Here is the declaration in the custom action:
<CustomAction
Id="MyCustomAction"
Title="Fun"
Description="Lets have fun"
RegistrationType="ContentType"
RegistrationId="0x01"
GroupId="ActionsMenu"
Location="DisplayFormToolbar"
Sequence="1000"
ControlAssembly="Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ac112ea8ee9f48g0"
ControlClass="Assembly.MyNamespace.MyCustomControl">
Any idea, what could go wrong?
Update:
This link is rendered as with this href:
javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$m$g_e00f473f_0a92_40aa_9805_03114c3f2da5$ctl00$ctl01$ctl00$toolBarTbl$RptControls$Fun", "", true, "", "", false, true))