You could use the following, but I should note that sometimes the width of
one cell effects the other cells so you may need to play with this.
Public Sub Display2_ItemDataBound(sender As Object, e As
DataGridItemEventArgs)
'this is if you are in edit mode
if display2.EditItemIndex > -1 then
if display2.EditItemIndex = e.item.itemindex then
ctype(e.Item.Cells(3).controls(0),textbox).Width = Unit.Pixel(35)
ctype(e.Item.Cells(6).controls(0),textbox).Width = Unit.Pixel(45)
ctype(e.Item.Cells(7).controls(0),textbox).Width = Unit.Pixel(35)
ctype(e.Item.Cells(8).controls(0),textbox).Width = Unit.Pixel(45)
ctype(e.Item.Cells(9).controls(0),textbox).Width = Unit.Pixel(225)
else
e.item.visible = false
end if
'this is if you are not
ctype(e.Item.Cells(3),tablecell).Width = Unit.Pixel(35)
end if
End Sub
"yop" < XXXX@XXXXX.COM > wrote in message
news:0e4001c3672b$0d4e0f20$ XXXX@XXXXX.COM ...
> All
>
> How do you stop the datagrid auto resizing?
> I have a grid in a page and if the recordset returns the
> 12 records which is the setting for the paging then the
> grid is sized spot on in the page and each row is the
> correct size.
> If the recordset only returns 2 records then the grid is
> stretched to fix the window and the rows are miles too
> wide.
>
> How do I stop this
>
> Thanks