Hello Dhaval,
Basically, there should be no difference where you position the link buttons in the grid (in the pager or footer) as long as you assign
CommandName and
CommandArgument for them. Thus the
event bubbling mechanism of the grid should raise the
ItemCommand event of the control on button click. Then you can intercept the command and filter the records in the grid in conjunction with the user's choice.
Hence you may try hooking the
ItemCreated event of the grid, check whether the item which is about to be created is footer item, create the link buttons for the alphabetic pager and add them in the footer. Below is some bare-bone logic:
private void RadGrid1_ItemCreated(object sender, Telerik.WebControls.GridItemEventArgs e) |
{ |
if (e.Item.ItemType == GridItemType.Footer) |
{ |
GridFooterItem footerItem = (GridFooterItem)e.Item; |
footerItem.Controls.Clear(); |
for (int i = 65; i <= 65 + 25; i++) |
{ |
int recordcount = DataSourceHelperCS.GetLetterCount(((char)i).ToString()); |
int pagecount = (int)(recordcount / RadGrid1.PageSize); |
|
for (int j = 0; j <= pagecount; j++) |
{ |
LinkButton linkButton1 = new LinkButton(); |
LiteralControl lc = new LiteralControl(); |
|
lc.Text = " "; |
linkButton1.Text = "" + (char)(i) + j.ToString(); |
|
linkButton1.CommandName = "alpha"; |
linkButton1.CommandArgument = "" + (char)(i) + j.ToString(); |
|
footerItem.Controls.Add(linkButton1); |
footerItem.Controls.Add(lc); |
} |
} |
} |
} |
The code in the
ItemCommand handler remains the same. Thus you should preserve the default pager and still have alphabetic pager below it.
Greetings,
Stephen
the
telerik team