ASP.Net Datagrid width ...
Hi,
This should be simple, but, alas, it's not. :confused: I'm creating a datagrid dynamically in VB.net. I would like to increase the width of the datagrid after it has been created to put some spacing between the columns.
I've tried to accomplish this like so:
VB Code:
dGrid.Width = Web.UI.WebControls.Unit.Percentage(dGrid.Width.Value * 1.5)
; however, dGrid.Width.Value is 0.0 even after my datagrid has been populated with data. :confused: How can I increase the width of the datagarid without assigning some arbitrary value like this:
VB Code:
dGrid.Width = Web.UI.WebControls.Unit.Percentage(60)
? I want to size the datagrid dynamically based on it's width after it's populated.
Thanks,
1Source
Re: ASP.Net Datagrid width ...
Re: ASP.Net Datagrid width ...
The true dataGrid width cannot be read at the server end.
Even when you specify a width, the browser might ignore it and assign a different width (like if the content is too long to fit).
Your best bet is to make it not dependant on a specified width.
That said, what is the aversion to using width="100%" ?
Re: ASP.Net Datagrid width ...
If you want cellspacing, set the cellspacing value of the asp:datagrid tag.