473,395 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Setting pager-style in DataGrid

Hi all,

is it possible to set a separate style in a datagrid pager for the selected
page to make it more clear for the user which page is selected?
For example: page 3 is selected out of the 8 possible pages and the number 3
is then displayed in bold and with an alternate color.

There's a pager style but there is no setting for the selected page.

TIA
Friso Wiskerke
Nov 19 '05 #1
1 3506
Hi Frisko,

you can achieve the same by modifying the pager properties in the DataGrid's
ItemCreated event.

Add the following event handler in the InitializeComponent() method -

this.DataGrid1.ItemCreated += new
System.Web.UI.WebControls.DataGridItemEventHandler (this.DataGrid1_ItemCreated);

The DataGrid ItemCreated method code will be -

private void DataGrid1_ItemCreated(object sender, DataGridItemEventArgs e)
{
if ( e.Item.ItemType == ListItemType.Pager)
{
TableCell Pager = (TableCell) e.Item.Controls[0];
for(int i = 0;i < Pager.Controls.Count ; i++ )
{
object pageNumbers = Pager.Controls[i];
if (pageNumbers.GetType().Name == "DataGridLinkButton")
{
LinkButton lbt = (LinkButton) pageNumbers;
lbt.ForeColor = System.Drawing.Color.Gray;
}
else if(pageNumbers.GetType().Name == "Label")
{
Label lbl = (Label) pageNumbers;
lbl.ForeColor = System.Drawing.Color.Black;
lbl.Font.Bold = true;
}
}
}
}

HTH.

"Friso Wiskerke" wrote:
Hi all,

is it possible to set a separate style in a datagrid pager for the selected
page to make it more clear for the user which page is selected?
For example: page 3 is selected out of the 8 possible pages and the number 3
is then displayed in bold and with an alternate color.

There's a pager style but there is no setting for the selected page.

TIA
Friso Wiskerke

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: Richard | last post by:
My employer currently pays me $1/hour when I carry a pager. I have to carry the pager every fourth week. The problem is that my employer insists that I be available when I'm carrying the pager. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.