Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ques abt collection and datagrid tablestyle

Status
Not open for further replies.

purplehaze1

Programmer
Jul 23, 2003
86
US
I am binding the collection to a Datagrid. I can bind to the collection successfully. I am using a tablestyle to limit the data the datagrid displays.
However, the tablestyle don't work. How can I make tablestyle to work for collections? another ques, what's the mapping name to be given for tablestyle
when you are using collection? Thanks again. Here's my code below for formatting tablestyle (it works if I use dataset. I know mapping name while using dataset, but not for collections.)

With grdRequest
.BackColor = Color.GhostWhite
.BackgroundColor = Color.Lavender
.BorderStyle = BorderStyle.None
.CaptionBackColor = Color.RoyalBlue
.CaptionFont = New Font("Tahoma", 10.0!, FontStyle.Bold)
.CaptionForeColor = Color.Bisque
.CaptionText = ""
.Font = New Font("Tahoma", 8.0!)
.ParentRowsBackColor = Color.Lavender
.ParentRowsForeColor = Color.MidnightBlue
End With

Dim grdTableStyle1 As New DataGridTableStyle()
With grdTableStyle1
.AlternatingBackColor = Color.GhostWhite
.BackColor = Color.GhostWhite
.ForeColor = Color.MidnightBlue
.GridLineColor = Color.RoyalBlue
.HeaderBackColor = Color.MidnightBlue
.HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
.HeaderForeColor = Color.Lavender
.MappingName = "RecipRequestList" ' ???Dunno what mapping name
.PreferredColumnWidth = 200
.PreferredRowHeight = 20
End With


Dim grdColStyle1 As New DataGridTextBoxColumn()

With grdColStyle1
.HeaderText = "First Name"
.MappingName = "first_nme"
.Width = 100
End With

Dim grdColStyle2 As New DataGridTextBoxColumn()
With grdColStyle2
.HeaderText = "Middle Name"
.MappingName = "m_nme"
.Width = 100
End With

Dim grdColStyle3 As New DataGridTextBoxColumn()
With grdColStyle3
.HeaderText = "Last Name"
.MappingName = "last_nme"
.Width = 100
End With

grdTableStyle1.GridColumnStyles.AddRange _
(New DataGridColumnStyle() _
{grdColStyle1, grdColStyle2, grdColStyle3 })

grdRequest.TableStyles.Add(grdTableStyle1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top