pootle_flump
asked on
Alter GridView columns properties
VS 2005
ASP.Net
VB.NET
Hi
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.Confi guration.C onfigurati onManager. AppSetting s.Get("Att ConString" ))
Dim AttCommand As SqlCommand
In New():
AttCommand = New SqlCommand("dbo.MySproc", Connection)
AttCommand.CommandType = Data.CommandType.StoredPro cedure
AttAdapter = New SqlDataAdapter(AttCommand)
AttSet = New DataSet
AttAdapter.Fill(AttSet, "AttDets")
In load():
Me.MyGridView.DataSource = AttSet
Me.MyGridView.DataMember = "AttDets"
Me.MyGridView.DataBind()
The GridView control is populated correctly however I cannot set the GridView column widths. If I try:
Debug.Print(Me.MyGridView. Columns.Co unt)
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?
Thanks
EDIT - changed title and some text - I had written DataView instead of GridView a couple of times.
ASP.Net
VB.NET
Hi
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.Confi
Dim AttCommand As SqlCommand
In New():
AttCommand = New SqlCommand("dbo.MySproc", Connection)
AttCommand.CommandType = Data.CommandType.StoredPro
AttAdapter = New SqlDataAdapter(AttCommand)
AttSet = New DataSet
AttAdapter.Fill(AttSet, "AttDets")
In load():
Me.MyGridView.DataSource = AttSet
Me.MyGridView.DataMember = "AttDets"
Me.MyGridView.DataBind()
The GridView control is populated correctly however I cannot set the GridView column widths. If I try:
Debug.Print(Me.MyGridView.
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?
Thanks
EDIT - changed title and some text - I had written DataView instead of GridView a couple of times.
ASKER
Hi Mods
I think I have cracked this. I will post the solution shortly.
Cheers
I think I have cracked this. I will post the solution shortly.
Cheers
ASKER
Solution:
http://www.dbforums.com/showthread.php?p=4545223&posted=1#post4545223
Mods - apols for the link. If you would rather I pasted the solution on here please let me know.
Please may I also have my points refunded?
:-)
http://www.dbforums.com/showthread.php?p=4545223&posted=1#post4545223
Mods - apols for the link. If you would rather I pasted the solution on here please let me know.
Please may I also have my points refunded?
:-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER