Prysson
asked on
problem seeting maximum width to gridview coumn
I have a gridview and I want to fix the column size to a certain size regardless of the length of the data in a given cell.
I have tried everythign I can think of from
gvwProjects.Columns[1].Ite mStyle.Wid th
gvwProjects.Columns[1].Ite mStyle.Wra p
to setting the length of the lblContol in the template but no matter what I do the column size automatically increases beyond my fixed size to meet the size of the longest cell in the bound datatable.
Anyone have any ideas?
I have tried everythign I can think of from
gvwProjects.Columns[1].Ite
gvwProjects.Columns[1].Ite
to setting the length of the lblContol in the template but no matter what I do the column size automatically increases beyond my fixed size to meet the size of the longest cell in the bound datatable.
Anyone have any ideas?
ASKER
Ive already seen that link and it doesnt make any sense.
Im talking about a gridview how does
<link href="abc.css" rel="stylesheet" type="text/css" />
cause a gridview column to have a fixed column width.
a <link href /> isnt a gridview
Im talking about a gridview how does
<link href="abc.css" rel="stylesheet" type="text/css" />
cause a gridview column to have a fixed column width.
a <link href /> isnt a gridview
will this work for you? I mean using a template field
http://msdn.microsoft.com/en-us/library/bb288031.aspx
http://msdn.microsoft.com/en-us/library/bb288031.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
maybe I am missing something here.. I just dont understand how you are getting the gridview to reference the css file to apply the style given the examples above..nowhere do I see any reference to the css file in teh gridview or any of the item templates.
AM I just being blind or obtuse?
AM I just being blind or obtuse?
ASKER
.
the comment is
You do not need to write any code behind.
GridView will render itself as html element.
So you can write one file named abc.css.
table
{
table-layout:fixed;
}
td
{
word-wrap:break-word;
}
Then all you need to do is to reference it from aspx file using <link href="abc.css" rel="stylesheet" type="text/css" />