Hi,
I have paging user control.
pager.ascx code
public delegate void PageChangedEventHandler(object sender, CustomPageChangeArgs e);
public event PageChangedEventHandler PageChanged;
protected void lnkPageNumbers_Click(object sender, EventArgs e)
{
SetCurrentPage(Convert.ToInt32(((LinkButton)sender).Text));
}
private void SetCurrentPage(int currentPage)
{
Pager_PageChanged(this, args);
}
If I add user control at compile time it works
<Custom:Pager ID="CustomPager" runat="server" önPageChanged="CustomPager_PageChanged" />;
********
If user control added at runtime it work partially. I am able to set properties of user control but I am not able to fire event on page number click.
parent.aspx code
if (some condition)
{
LinkPager CustomPager1 = (LinkPager)LoadControl("~/LinkPager.ascx");
CustomPager1.PageChanged+=new LinkPager.PageChangedEventHandler(this.CustomPager_PageChanged);
}
protected void CustomPager_PageChanged(object sender, CustomPageChangeArgs e)
{
}
I am not getting any error but
CustomPager_PageChanged
is not getting called.
Please let me know if anybody has any idea about the issue.
Thanks,
Nagraj