I have a link button on the .aspx page :
<asp:LinkButton runat="server" ID="lnkSynEvent" Text="Export Event to Outlook"></asp:LinkButton>
and a method on code behind page :
protected void lnkSynEvent_Click(object sender, EventArgs e, DataTable data)
{}
Now at the runtime I am trying to bind the event to the Link Button, inside a function
lnkSynEvent.Click +=new EventHandler((sender,args) => lnkSynEvent_Click(sender,args, eventData));
But when user click on the Link button it doesn't fire the Click event. Not sure why.
Please help.
You need to attach the event back on every post back. In other words, if you attach an event inside
if (!IsPostBack)
, it wont' fire.The following code won't fire click event