1 Replies - 1153 Views - Last Post: 21 June 2013 - 03:28 PM Rate Topic: -----

#1 prasad.weer  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 76
  • Joined: 10-November 11

DataGrid column width in runtime

Posted 20 June 2013 - 12:08 AM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: DataGrid column width in runtime

#2 jace75  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 31
  • Joined: 11-June 13

Re: DataGrid column width in runtime

Posted 21 June 2013 - 03:28 PM

The columns of a Gridview object will conform to the width of the widest cell. Without setting the "ColumnSpan" property of the cell, no specification will cause any individual column/row intersect to break formation. Essentially, where one goes, they all go. That said, it is difficult to speculate at a suitable solution to your dilemma.

Without seeing more code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1