DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 23 May 2007 18:24:32 +0800,    posted on: microsoft.public.dotnet.framework.aspnet.buildingcontrols        back       

Thread Index
  1    Bora
          2    unknown
          3    Bora


AutoGeneratedField   
Why a TemplateField cannot be a AutoGeneratedField when we have an inherited 
GridView class?

What is the difference between
System.Collections.ICollection CreateColumns(PagedDataSource dataSource, 
bool useDataSource)
and
AutoGeneratedField CreateAutoGeneratedColumn(AutoGeneratedFieldProperties 
fieldProperties)
?

Regards,
Bora Inceler
Date:Wed, 23 May 2007 18:24:32 +0800   Author:  

Re: AutoGeneratedField   

> Why a TemplateField cannot be a AutoGeneratedField when we have an inherited
> GridView class?


It's because AutoGeneratedField is a final class that inherits from
BoundField which inherits DataControlField and TemplateField inherits
DataControlField.

The CreateColumns method is used to create the automatically generated
column fields. Never used this method myself but see Dino Esposito's
article for an example on using CreateColumns() -
http://msdn.microsoft.com/msdnmag/issues/06/05/cuttingedge/default.aspx

The CreateAutoGeneratedColumn method creates one instance of a
AutoGeneratedField.
Say you wanted to autogenerate the fields for a gridview but only
enable sorting on 1 known field called "Supplier" then you'll probably
do something like:

Imports System.Web.UI.WebControls

Namespace SampleControls
    Public Class CustomGridView
        Inherits GridView

        Protected Overrides Function CreateAutoGeneratedColumn(ByVal
fieldProperties As
System.Web.UI.WebControls.AutoGeneratedFieldProperties) As
System.Web.UI.WebControls.AutoGeneratedField

            Dim field As AutoGeneratedField =
MyBase.CreateAutoGeneratedColumn(fieldProperties)

            'Turn off sorting on non-Supplier columns and leave
sorting only on the Supplier column
            If field.HeaderText <> "Supplier" Then
                field.SortExpression = ""
            End If

            Return field
        End Function

    End Class
End Namespace

Andy

On 23 May, 11:24, "Bora"  wrote:

> Why a TemplateField cannot be a AutoGeneratedField when we have an inherited
> GridView class?
>
> What is the difference between
> System.Collections.ICollection CreateColumns(PagedDataSource dataSource,
> bool useDataSource)
> and
> AutoGeneratedField CreateAutoGeneratedColumn(AutoGeneratedFieldProperties
> fieldProperties)
> ?
>
> Regards,
> Bora Inceler
Date:29 May 2007 09:20:57 -0700   Author:  

Re: AutoGeneratedField   
Thanks for the response.

All the things you told are fair and self-definitive.

Why I can't autogenerate custom fields? AutoGeneratedField is sub-class for 
BoundField but I can't use other BoundField inherited class. Forcing to 
return AutoGeneratedField is against OO for autogeneration. That should be 
fixed. I can't autogenerate a CheckBoxField or TemplateField. (I not have my 
own autogeneration using CreateColumns, so not bothering with this now) But 
the AutoGeneratedField class should be dropped and DataControlField should 
be used for CreateAutoGeneratedColumn method.

Am I wrong?

Bora

 wrote in message 
news:1180455657.236969.112870@p47g2000hsd.googlegroups.com...

>> Why a TemplateField cannot be a AutoGeneratedField when we have an 
>> inherited
>> GridView class?
>
> It's because AutoGeneratedField is a final class that inherits from
> BoundField which inherits DataControlField and TemplateField inherits
> DataControlField.
>
> The CreateColumns method is used to create the automatically generated
> column fields. Never used this method myself but see Dino Esposito's
> article for an example on using CreateColumns() -
> http://msdn.microsoft.com/msdnmag/issues/06/05/cuttingedge/default.aspx
>
> The CreateAutoGeneratedColumn method creates one instance of a
> AutoGeneratedField.
> Say you wanted to autogenerate the fields for a gridview but only
> enable sorting on 1 known field called "Supplier" then you'll probably
> do something like:
>
> Imports System.Web.UI.WebControls
>
> Namespace SampleControls
>    Public Class CustomGridView
>        Inherits GridView
>
>        Protected Overrides Function CreateAutoGeneratedColumn(ByVal
> fieldProperties As
> System.Web.UI.WebControls.AutoGeneratedFieldProperties) As
> System.Web.UI.WebControls.AutoGeneratedField
>
>            Dim field As AutoGeneratedField =
> MyBase.CreateAutoGeneratedColumn(fieldProperties)
>
>            'Turn off sorting on non-Supplier columns and leave
> sorting only on the Supplier column
>            If field.HeaderText <> "Supplier" Then
>                field.SortExpression = ""
>            End If
>
>            Return field
>        End Function
>
>    End Class
> End Namespace
>
> Andy
>
> On 23 May, 11:24, "Bora"  wrote:
>> Why a TemplateField cannot be a AutoGeneratedField when we have an 
>> inherited
>> GridView class?
>>
>> What is the difference between
>> System.Collections.ICollection CreateColumns(PagedDataSource dataSource,
>> bool useDataSource)
>> and
>> AutoGeneratedField CreateAutoGeneratedColumn(AutoGeneratedFieldProperties
>> fieldProperties)
>> ?
>>
>> Regards,
>> Bora Inceler
>
> 
Date:Tue, 12 Jun 2007 16:04:03 +0800   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us