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].ItemStyle.Width
gvwProjects.Columns[1].ItemStyle.Wrap
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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
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.
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" />