PC Review


Reply
Thread Tools Rate Thread

Customizing PagerStyle in a datagrid

 
 
Larry Viezel
Guest
Posts: n/a
 
      10th Aug 2005
I would like to add controls to the pagerstyle item in my datagrid.
Simple enough:

private void DataGrid_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Pager)
{
//retrieve the pager cell
TableCell PagerCell = (TableCell)e.Item.Controls[0];

//format the column span of PagerCell
int TCS = PagerCell.ColumnSpan; //total column span
PagerCell.ColumnSpan = Convert.ToInt32(Math.Floor(TCS / 2));

//Add the new cell
e.Item.Controls.AddAt(0, new
System.Web.UI.WebControls.TableCell());
TableCell NewCell = (TableCell)e.Item.Controls[0];

//format the new cell
NewCell.ColumnSpan = TotalColumnSpan - PagerCell.ColumnSpan;
NewCell.HorizontalAlign = HorizontalAlign.Left;

//Code to add controls to the new cell goes here...
}

}

I can add more new cells as needed to add even more controls that my
wacky designers want. The trouble I am having is that using the methods
I have, I am can only add as many controls as there are columns I am
displaying from the grid's datasource before I mess up the display. I'd
also be bound to the width and position of these columns. The simple
solution is to use a nested table. But I don't quite know how to
program that around the already existing and defined PagerCell.

Is there an easy way to add a table in PagerCell and then move the
current contents of PagerCell (the previous and next linkbutton
controls) into a cell in that table?

Any help would be appreciated.
Larry.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Customizing the DataGrid MRW Microsoft ASP .NET 2 11th Mar 2006 06:14 PM
Customizing the Datagrid or Repeater JD Microsoft ASP .NET 1 27th Jul 2005 02:29 PM
Datagrid - Customizing Asterisk excelleinc.com Microsoft VB .NET 1 17th Mar 2005 06:53 AM
customizing PagerStyle-Mode in the Datagrid control aftab Microsoft ASP .NET 0 15th May 2004 02:43 PM
Datagrid Customizing Bui Trung Nguyen Microsoft C# .NET 1 16th Sep 2003 12:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:05 AM.