Im developing application using ASP.net + VB.net
Now i want to change column width at run time. But in run time it doesn't work.

This is what i did up to now.
data bind in form load like this.

myGrid.datasource = myDataSet.table(0)
myGrid.databind()

In here dataset come properly.

in grid data bound event

 If e.Row.RowType = DataControlRowType.Header Then

Dim cell As TableCell = e.Row.Cells(1)
            cell.Width = New Unit(200) 'I added "200px" instead of 200. But it didn't work.
cell.text = "abc" 'This is working. It is show the header as abc

end if

in above code i added (as an experiment) cell.wrap = false and cell.wrap = true. that code also not effected.
There is no any error. But width doesnt work.

Recommended Answers

All 2 Replies

I added style="table-layout:fixed" to the ASP grid code. Now the problem is ok.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.