Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid column widths enlarging 1

Status
Not open for further replies.

RSfromCO

Programmer
May 3, 2002
149
0
0
US
I have read some other threads in this forum, and it sounds like what I am experiencing may just be the way the DataGrid works. I just have to ask...

If I have ItemStyle-Wrap="False" and Width="100", the width of my column seems to stay fixed at 100 pixels as long as the data in that column is less than 100 pixels wide. If one of the rows of the data has an item that does not fit in that 100 pixels it stretches the column of the grid so that it fits around the data.

And there is nothing I can do about this ???
 
ItemStyle-Wrap="True"

That is the only way that you can have the contents of the cell wrap if it is longer than 100 pixels.

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Hi Scsii,
I used the command u mentioned to reset the width of a column and Iam getting this error -
'width' is not a member of 'System.Web.UI.WebControls.DataGridColumn'

Can you please help me..?

Thanks
Srini
 
rav: where are you putting the width statement?
 
Iam specifying the columns at design time..

This is the code behing code..
fgrdRecovExtSumm.datasource = ldds
fgrdRecovExtSumm.databind()

After this databind statement Iam putting the width statement.
Do u want me to put in OnItemdatabound event..?
I cant generate the columns at runtime as I already defined so many columns at design time..
Please suggest me...


Thanks
Srinivas
 
rav: I'd put it right in the grid:

<asp:BoundColumn DataField=&quot;Group_Name&quot; HeaderText=&quot;Group
Name&quot; ItemStyle-width=&quot;20&quot; ItemStyle-Wrap=&quot;True&quot;/>

I would sc's procedure if all the columns need to be a certain width, otherwise AtomicChip is correct in that setting the &quot;wrap&quot; to true does the job.
 
Thanks man..
It is working fine now..

Thanks a lot for your help..
SRini
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top