Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Overriding column types

Reply
Thread Tools

Overriding column types

 
 
Robert
Guest
Posts: n/a
 
      03-07-2004
I have created a custom, scrollable datagrid with expandable
(draggable) columns. However, I accomplished the expandable column
part in a very bad way by basically intercepting the output from the
rendering and doing a search/replace on the td tag to add attributes.
It all works perfect for BoundColumns, but can misbehave with Template
and Button columns.

It seems what I want really want to do is create a class for each
column type and override the implementation to add particular
information for each column. But I'm not sure how to do that.

I thought it would be as simple as creating a class named BoundColumn
that inherits from DataGridColumn, add my info to the cell and so on
for the other types. That doesn't seem to be working.

Does anyone have any experience with this?

namespace MyScrollGrid
{
/// <summary>
/// Summary description for BoundColumn.
/// </summary>
public class BoundColumn : DataGridColumn
{
public BoundColumn() : base()
{
//
// TODO: Add constructor logic here
//
}

public string DataField
{
get{return this.DataField;}
set{this.DataField = value;}
}

public override void InitializeCell(TableCell cell, int columnIndex,
ListItemType itemType)
{

base.InitializeCell(cell, columnIndex, itemType);

switch(itemType)
{
case ListItemType.Item:
case ListItemType.AlternatingItem:
case ListItemType.SelectedItem:
{
cell.Attributes.Add("style","'text-overflow: ellipsis; overflow:
hidden;");
cell.Width=Unit.Pixel(140);
break;
}
case ListItemType.EditItem:
break;
}
}
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Can XSD simple types be derived from complex types? Soren Kuula XML 2 12-01-2005 07:51 PM
Where are ref types that are members of value types stored? Sathyaish ASP .Net 2 05-22-2005 07:32 PM
Overriding builtin types Lonnie Princehouse Python 0 03-05-2004 07:53 PM
Boost + Python C/API: Mixing python return types with boost return types Steve Knight Python 2 10-10-2003 10:11 AM
STD types vs C++ intrinsic types Jeremy Cowles C++ 5 08-19-2003 05:33 PM



Advertisments