Hello i added the following button inside of a grid:
<EmptyDataTemplate>
<asp:Button ID="Button1" runat="server" CssClass="fancy-button"
onclick="Button1_Click" Text="Adauga un spatiu" />
</EmptyDataTemplate>
The code behind for this:
protected void Button1_Click(object sender, EventArgs e)
{
adsDetails.ChangeMode(DetailsViewMode.Insert);
}
The button doesn’t fire when i click on it and i tried to add :
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
I receive : “A control with ID ‘Button1’ could not be found for the trigger in UpdatePanel ‘AddressGridViewUpdatePanel’. “
Any idea how i could fix this?
Thank you.
AsyncPostBackTriggerneeds the specified control in the same naming container (see remarks in MSDN) as the parent UpdatePanel.I suggest you to use ScriptManager.RegisterAsyncPostBackControl to register your button as async trigger instead.