1.11M Members

DataGrid column width in runtime

 
0
 

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.

 
1
 

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

Question Answered as of 1 Year Ago by LastMitch
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: