Atif, the HyperLinkColumn does not provide any property to limit the
number of characters. You will either have to:
(a) Use a TemplateColumn, calling some custom function to limit the
length. That is, you might have:
<asp:TemplateColumn>
<ItemTemplate>
<%# TruncateURL(DataBinder.Eval(Container.DataItem,
"Description"), DataBinder.Eval(Container.DataItem("ProcessLineIte mId"))
%>
</ItemTemplate>
</asp:TemplateColumn>
And then create a method in your code-behind class like:
Protected Function TruncateURL(desc as String, lineItemID as Integer)
as String
If desc.Length > 100 then
desc = desc.Substring(0, 95) & "..."
End If
Return "<a href=""LineItem.aspx?LineItemId=" & lineItemID &
"&Process=1"">" & desc & "</a>"
End Function
(b) Create a custom DataGridColumn class that can limit the number of
characters based on some property. There is an example of such a
class at:
http://aspnet.4guysfromrolla.com/articles/100202-1.aspx
hth
Scott Mitchell
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com
* When you think ASP, think 4GuysFromRolla.com!
(Atif Jalal) wrote in message news:< m>...
> I am using a Datagrid control and one of its column is a
> 'HyperLinkColumn'. The link text for this HyperLinkColumn is sometimes
> beyond 100 characters. I would like to display the link on multi-line
> if the number of characters in the link exceed 100 characters. I tried
> adding the <ItemStyle> to the HyperLinkColumn tag but it did not
> work, the whole of the link is displayed on one line with the column
> width getting extended.
>
> <asp:HyperLinkColumn
> DataNavigateUrlFormatString="'LineItem.aspx?LineIt emId={0}&Process=1&'"
> DataNavigateUrlField="ProcessLineItemId" DataTextField="Description"
> HeaderText="Line Item - Description">
>
> <ItemStyle Width="100px" Wrap=True></ItemStyle>
>
> </asp:HyperLinkColumn>
>
> Is it that <ItemStyle> does not work with <asp:HyperLinkColumn> ? Any
> help appreciated.