What I don't understand is, I have a pager_Create function, it is like that
public void createPager()
{
Div_Pager.Controls.Clear();
ImageButton left = new ImageButton(); left.ID = "leftButton";// +new Random().Next();
left.Click+=new ImageClickEventHandler(pager_Left_Click);
left.ImageUrl = "http://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/Teknik_raporlar/left.bmp";
ImageButton right = new ImageButton(); right.ID = "rightButton";// +new Random().Next();
right.Click+=new ImageClickEventHandler(pager_Right_Click);
right.ImageUrl = "http://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/Teknik_raporlar/right.bmp";
Div_Pager.Controls.Add(left);
Div_Pager.Controls.Add(right);
if (int.Parse(ViewState["NOP"].ToString()) <= 1) // Number of Pages
{
Div_Pager.Visible = false;
}
else
{
Div_Pager.Visible = true;
if (int.Parse(ViewState["CurrentPage"].ToString()) <= 1)
{
left.Visible = false;
}
if (int.Parse(ViewState["CurrentPage"].ToString()) >= int.Parse(ViewState["NOP"].ToString()))
{
right.Visible = false;
}
}
}
protected void pager_Left_Click(object sender, EventArgs e)
{
ViewState["CurrentPage"] = int.Parse(ViewState["CurrentPage"].ToString()) - 1;
}
protected void pager_Right_Click(object sender, EventArgs e)
{
ViewState["CurrentPage"] = int.Parse(ViewState["CurrentPage"].ToString()) + 1;
}
and what I don't understand is this, how come this pagers buttons not firing? I mean I am creating the same buttons everytime the pager is created. So how is it possible. What is its relation about page rendering. My simplified code is like this:
override Render()
{
function1()
}
Page_Load()
{
function1()
}
funtion1()
{
createpager()
}