Linkbutton firing every other time issue
am 31.03.2008 01:50:11 von maflatounHi guys,
I'm running into a little problem I was hoping someone has experienced
before or knows a why a workaround. I'm generating a navigation menu
on my database resultsets that would show you the next and previous
pages. However, it only fires the first time and the alternating
times. So when I click page 1 it works, then page 2 first time fails,
next time after that worksworks. Here's my code
for (int x = minRange; x <= maxRange; x++)
{
if (x == pageIndex)
{
Label lbPageIndex = new Label();
lbPageIndex.Text = x.ToString();
phListNav.Controls.Add(lbPageIndex);
}
else
{
LinkButton lbNav = new LinkButton();
lbNav.Text = x.ToString();
lbNav.CssClass = "paging1";
lbNav.CommandArgument = x.ToString();
lbNav.Command += new
CommandEventHandler(lbNav_Command);
phListNav.Controls.Add(lbNav);
}
}
protected void lbNav_Command(object sender, CommandEventArgs e)
{
pageIndex = int.Parse(e.CommandArgument.ToString());
BindSearchResults();
}
So it works on every other click starting with the first one. Any idea
why this might be happening?
Thx
Maz