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

There is no any error. But width doesnt work.

Why used cell.wrap?

cell.Width = New Unit(200) 'I added "200px" instead of 200. But it didn't work.

I'm not familiar with VB. Since you are creating an application using ASP.net + VB.net you should used something more flexible …

Jump to Post

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.