For the first problem you can use tool tip as solution and use fix width. so additional words display in tool tip. below i m show the way of writing the tool tip solution and hope you can edit it and customize it to your solution.
in OnRowDataBound event set the maximum length which fit to the column and other characters send to tool tip.
user this code inside onrowbound event
const int maxLength =10;
if (obj.CompanyName.Length > maxLength)
{
((Label)e.Row.FindControl("lblBindName")).Text = this.GetExtraWordsforToolTip(obj.CompanyName, maxLength);
}
and extra words will display in tool tip.
private string GetExtraWordsforToolTip(string word, int wordMaxLenth)
{
string strDescription = @"<p><a class='tooltip' href='#'>" + text.Substring(0, maxLength - 7) + "(...)" + @"<span class='normal'>" + text + "</span></a></p> ";
return strDescription;
}
.tooltip
{
border-bottom: 1px dotted #000000;
color: #000000;
outline: none;
cursor: pointer;
text-decoration: none;
position: relative;
}
.tooltip span
{
margin-left: -999em;
position:absolute;
}
.tooltip:hover span
{
border-radius: 5px 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
font-family: Verdana,Calibri, Tahoma, sans-serif;
position: absolute;
left: 1em;
top: 2em;
z-index: 99;
margin-left: 0;
}
.tooltip:hover img
{
border: 0;
margin: -10px 0 0 -55px;
float: left;
position: absolute;
}
.tooltip:hover em
{
font-family: Verdana,Calibri, Tahoma, sans-serif;
font-size: 1.2em;
font-weight: bold;
display: block;
padding: 0.2em 0 0.6em 0;
}
.normal
{
background: #d6d0fd;
border: 1px solid #686868;
word-wrap: break-word;
width:200px;
padding: 0.7em 1em;
}
For second problem you can use empty data template as solution
and use three templates header, item and empty
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="left" width="8%">
CompanyName
</td>
<td align="left">
SubIndustry
</td>
</tr>
</table>
</HeaderTemplate>
<EmptyDataTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
Sorry, 0 items found.
</td>
</tr>
</table>
</EmptyDataTemplate>
hope this will help..