Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get gridview column width?

10 views
Skip to first unread message

Penny

unread,
Oct 11, 2007, 2:10:02 PM10/11/07
to
I have a gridview in web page. I put it into a Panel control in order to let
gridview can be scrolled.

I need the header row of the gridview is fixed not to be scrollable. Many
people sugested to use CSS. It is too complicated to me. So, I try to get
every column's width to create a Label control to pretend the gridview's
herader.

The display of my gridview is fine. But I always get 0 as the column width.
Can any one give me a help with code to get width of column. Thank you.

My code is like:
Private adp As System.Data.OleDb.OleDbDataAdapter
adp = New System.Data.OleDb.OleDbDataAdapter()
Dim ds As DataSet = New DataSet()
:
:
adp.Fill(ds, "dataset")
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
Dim intC1Width As Int16 = GridView1.HeaderRow.Cells(1).Width.Value

0 new messages