I have a composite sever control with a gridview and a custom navigation toolbar, could you take a look, why events of button MoveNext in the toolbar is not fired? Thanks in advance,
Code:
public class cSCGridNavigatorPanel: WebControl, INamingContainer
{
..
protected ImageButton fbtnNext;
..
public event ImageClickEventHandler btnNext_Click;
protected void fbtnNext_Click(object sender, ImageClickEventArgs e)
{
if (btnNext_Click != null)
btnNext_Click(sender, e);
}
..
protected override void CreateChildControls()
{
..
fbtnFirst = new ImageButton();
fbtnFirst.Click += new ImageClickEventHandler(fbtnFirst_Click);
this.Controls.Add(fbtnFirst);
..
}
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
AddAttributesToRender(writer);
..
fbtnNext.RenderControl(writer);
..
}
}
public class cSCGridWithNavigatorPanel: WebControl, INamingContainer
{
public cSCGridWithNavigatorPanel() {}
...
GridView fDataGrid;
GridNavigatorPanel fNavigatorPanelTop;
protected void MoveNext(object sender, System.Web.UI.ImageClickEventArgs e)
{
if (fDataGrid.CurrentPageIndex < fDataGrid.PageCount-1)
fDataGrid.CurrentPageIndex += 1;
}
protected override void CreateChildControls()
{
this.DataBind();
fNavigatorPanelTop = new cSCGridNavigatorPanel(this.ClientID,"fNavigatorPanelBottom");
fNavigatorPanelTop.ID = "fNavigatorPanelTop";
..
fNavigatorPanelTop.btnNext_Click += new ImageClickEventHandler(MoveNext);
..
this.Controls.Add(fNavigatorPanelTop);
}
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
AddAttributesToRender(writer);
..
fNavigatorPanelTop.RenderControl(writer);
..
}
}