Hello All,
I just wanted to know if there is any way to dynamically set the width of a column inside a table within a datalist based on the length of the text fetched from the database.I am inserting my code.In the code below I want the width of collapsible panel to be dynamically set based on the length of the address and interest fields.Please give some suggestions.
<asp:Datalist ID="Datalist_PersonnelData" runat="server" Width="60%" >
<HeaderTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="1600">
<tr>
<td width="400">Full Name</td>
<td width="400">Phone</td>
<td width="400">Email</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="1600">
<tr>
<td width="400">
<asp:Panel ID="Panel2" runat="server">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/plus.jpg" ></asp:Image>
<%#Eval("Full Name").ToString()%>
</asp:Panel>
</td>
<td width="400">
<%#Eval("Phone").ToString()%>
</td>
<td width="400">
<%#Eval("Email").ToString()%>
</td>
</tr>
<tr>
//I want to set this width dynamically based on the length of text fetched from the //database
<td width="400">
<asp:CollapsiblePanelExtender ID="CollapsibleControl_Name" ExpandControlID="Panel2" runat="server" ImageControlID="Image1" ExpandedImage="~/images/minus.jpg" CollapsedImage="~/images/plus.jpg" ExpandDirection="Vertical" CollapseControlID="Panel2" Collapsed="true" EnableViewState="false" TargetControlID="Panel1"></asp:CollapsiblePanelExtender>
<asp:Panel ID="Panel1" runat="server" BorderStyle="Inset">
<strong>Address:</strong>
<asp:Label ID="Label_Address" runat="server" Text='<%#Eval("Address").ToString()%>'></asp:Label>
<br />
<br />
<strong>Interests:</strong>
<asp:Label ID="Label_Interests" runat="server" Text='<%#Eval("Interests").ToString()%>'></asp:Label>
<br />
<br />
<asp:HyperLink ID="HyperLink_FullDetails" runat="server" Text="Full Details" NavigateUrl="http://www.pqr.com/"></asp:HyperLink>
</asp:Panel>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Datalist>