5
Answers

alpha numeric pager issues please help

javier vilchis

javier vilchis

14y
3.5k
1
I have this:
 public partial class Glossario : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet objDataSet = new DataSet();
// Read in the XML file
objDataSet.ReadXml(Server.MapPath("glossary.xml"));

GridView1.DataSource = objDataSet;
GridView1.DataBind();

}

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
}

protected void GridView1_DataBound(object sender, EventArgs e)
{
SetPaging();
}

private void SetPaging()
{
GridViewRow row = GridView1.BottomPagerRow;
int alphaStart = 65;

for (int i = 1; i < GridView1.PageCount; i++)
{
LinkButton btn = new LinkButton();
btn.CommandName = "Page";

btn.CommandArgument = i.ToString();

if (i == GridView1.PageIndex + 1)
{
btn.BackColor = Color.BlanchedAlmond;
}

btn.Text = Convert.ToChar(alphaStart).ToString();
btn.ToolTip = "Page " + i.ToString();
alphaStart++;
PlaceHolder place = row.FindControl("PlaceHolder1") as PlaceHolder;
place.Controls.Add(btn);

Label lbl = new Label();
lbl.Text = " ";
place.Controls.Add(lbl);
}

}

}

this is the front end
 <asp:PlaceHolder ID="PlaceHolder" runat="server" />

I don't know what I'm doing wrong. can anyone help.
Answers (5)