By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 1,088 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Datagrid TableStyle Not working

P: n/a

Hi,

This is driving me crazy. Once the TableStyle is added (last line) the datagrid comes up blank. If I comment it out, the data grid shows the column names from the dataset. I must be doing something out of sequence

Thanks in advance for help provided

To

-------
Dim dsComputerFileDetails As New DataSet(

Dim dtFileDetails As New DataTable(
dtFileDetails.TableName = "dtFileDetails
dtFileDetails.Columns.Add("Name", Type.GetType("System.String")
dsComputerFileDetails.Tables.Add(dtFileDetails

Dim dgComputer As New DataGrid(
dgComputer.DataSource = dsComputerFileDetail
dgComputer.DataMember = "dtFileDetails
Controls.Add(dgComputer

Dim tsFileDetails As New DataGridTableStyle(
tsFileDetails.MappingName = "dtFileDetails

Dim dgtbc As New DataGridTextBoxColumn(
dgtbc.HeaderText = "Name
tsFileDetails.GridColumnStyles.Add(dgtbc

dgComputer.TableStyles.Add(tsFileDetails)
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I think your forgot to set the MappingName of the column:
dgtbc.MappingName = "Name"

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"tomp" <an*******@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...

Hi,

This is driving me crazy. Once the TableStyle is added (last line) the datagrid comes up blank. If I comment it out, the data grid shows the
column names from the dataset. I must be doing something out of sequence.
Thanks in advance for help provided!

Tom

--------
Dim dsComputerFileDetails As New DataSet()

Dim dtFileDetails As New DataTable()
dtFileDetails.TableName = "dtFileDetails"
dtFileDetails.Columns.Add("Name", Type.GetType("System.String"))
dsComputerFileDetails.Tables.Add(dtFileDetails)

Dim dgComputer As New DataGrid()
dgComputer.DataSource = dsComputerFileDetails
dgComputer.DataMember = "dtFileDetails"
Controls.Add(dgComputer)

Dim tsFileDetails As New DataGridTableStyle()
tsFileDetails.MappingName = "dtFileDetails"

Dim dgtbc As New DataGridTextBoxColumn()
dgtbc.HeaderText = "Name"
tsFileDetails.GridColumnStyles.Add(dgtbc)

dgComputer.TableStyles.Add(tsFileDetails)

Nov 20 '05 #2

P: n/a

That worked... Thanks, Jan!
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.