Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

DataField not member of 'System.Web.UI.WebControls.DataGridColumn'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tshad - 29 Aug 2007 04:12 GMT
I am getting this error trying to dynamically added a column to my DataGrid.

I have the following code:

Function CreateBoundColumn(c as DataColumn) as DataGridColumn
  Dim column as DataGridColumn  = new BoundColumn()
 column.DataField = c.ColumnName                                    <----  
the error
 column.HeaderText = c.ColumnName.Replace("_"," ")
 column.DataFormatString =setFormating(c)
 return column
End Function

But the code I borrrowed this from was:

'add bound columns to the datagrid
Dim datagridcol As New BoundColumn
datagridcol.HeaderText = "Candy Type"
datagridcol.DataField = "CandyType"
DataGrid1.Columns.Add(datagridcol)

Here they use DataField the same as I do.

Am I missing something to make this work?

Thanks,

Tom
Sherif Elmetainy - 29 Aug 2007 07:34 GMT
Dim column as BoundColumn = new BoundColumn()
column.DataField = c.ColumnName

>I am getting this error trying to dynamically added a column to my
>DataGrid.
[quoted text clipped - 25 lines]
>
> Tom
tshad - 29 Aug 2007 17:47 GMT
> Dim column as BoundColumn = new BoundColumn()
> column.DataField = c.ColumnName

That was it.

I don't know how I missed that.

Thanks,

Tom

>>I am getting this error trying to dynamically added a column to my
>>DataGrid.
[quoted text clipped - 25 lines]
>>
>> Tom

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.