Access Hyperlinks/LinkButtons in Datagrid Pager

J

Joey

Hello,

I need to be able to access the linkbuttons that are used for paging
inside a datagrid so I can set the style for what eventually becomes
the client-side html anchor tags.

I have read several posts about using the datagrid's PagerStyle
property, but this solution is simply inadequate. This is because I
need to be able to apply a CssStyle so that I can get at a:hover and
other CSS properties. PagerStyle only applies the selected style into
the tablecell text, and not the html anchor tags that are generated
within.

So far I have managed to do this successfully for the anchor tags in
the header, item, and alternating item sections by using the code below
inside of the ItemDataBound event...

if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem) || (e.Item.ItemType ==
ListItemType.SelectedItem))
{
((LinkButton)e.Item.Cells[8].Controls[0]).CssClass =
"Bold_Black_9pt_Sans_0000";
}

if(e.Item.ItemType == ListItemType.Header)
{
((LinkButton)e.Item.Cells[1].Controls[0]).CssClass =
"Bold_White_9pt_Sans_0000";
((LinkButton)e.Item.Cells[2].Controls[0]).CssClass =
"Bold_White_9pt_Sans_0000";
((LinkButton)e.Item.Cells[3].Controls[0]).CssClass =
"Bold_White_9pt_Sans_0000";
((LinkButton)e.Item.Cells[4].Controls[0]).CssClass =
"Bold_White_9pt_Sans_0000";
((LinkButton)e.Item.Cells[5].Controls[0]).CssClass =
"Bold_White_9pt_Sans_0000";
}

....but so far I have found no solution to get at the anchor tags in the
pager section.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top