Home All Groups Group Topic Archive Search About

Datagrid colum has no Dataformat property

Author
16 Feb 2005 9:58 PM
ree32
I am writing a webpage in VB.net.

I cant access the dataformat property of a column in the datagrid.

But I get this error in Visual Studio :

DataFormat is not a member of System.Web.UI.WebControls.DataGridColumn

Author
17 Feb 2005 1:54 AM
Elton Wang
Actually DataGridColumn is an abstract class. The Column
in DataGrid should one of its inherited 'Column' classes,
BoundColumn, TemplateColumn, HyperLinkColumn,
ButtonColumn, or EditCommandColumn. DataFormatString is
member of either BoundColumn or HyperLinkColumn, but not
of others. You should know the specific type of the column
you want to access. Only if it is BoundColumn or
HyperLinkColumn, you can access its DataFormatString
property by first casting the column to its specific type.

HTH,

Elton Wang


>-----Original Message-----
>I am writing a webpage in VB.net.
>
>I cant access the dataformat property of a column in the
datagrid.
>
>But I get this error in Visual Studio :
>
>DataFormat is not a member of
System.Web.UI.WebControls.DataGridColumn
Show quoteHide quote
>.
>
Author
17 Feb 2005 9:29 PM
ree32
So you can't do it for columns that you Autogenerate with on a datagrid.

"Elton Wang" <anonym***@discussions.microsoft.com> wrote in message news:<25f801c51493$98fe5540$a501280a@phx.gbl>...
you want to access. Only if it is BoundColumn or
Show quoteHide quote
> HyperLinkColumn, you can access its DataFormatString
> property by first casting the column to its specific type.
>
> HTH,
>
> Elton Wang