Alter GridView columns properties
Posted on 2006-05-15
New to ASP.NET (and especially VS 2005). I'm struggling with the formatting of a GridView control's columns.
In General Decs:
Dim AttAdapter As SqlDataAdapter
Dim AttSet As dataset
Dim Connection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("AttConString"))
Dim AttCommand As SqlCommand
AttCommand = New SqlCommand("dbo.MySproc", Connection)
AttCommand.CommandType = Data.CommandType.StoredProcedure
AttAdapter = New SqlDataAdapter(AttCommand)
AttSet = New DataSet
Me.MyGridView.DataSource = AttSet
Me.MyGridView.DataMember = "AttDets"
The GridView control is populated correctly however I cannot set the GridView column widths. If I try:
in a button click handler it returns 0.
The columns are known at design time so I can specify this then if required. Please could someone let me know what I am missing?
EDIT - changed title and some text - I had written DataView instead of GridView a couple of times.