标题:datagrid截取字符串
只看楼主
董晓云
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2010-4-5
结帖率:42.86%
已结贴  问题点数:6 回复次数:2 
datagrid截取字符串
datagrid怎么截取标题只显示8个字,后面用“...”代替
我的前台代码  
<asp:DataGrid ID="DataGrid2" runat="server" AutoGenerateColumns="False"
                                        BorderStyle="None" BorderWidth="0px" CellPadding="0" ShowHeader="False">
                                         <Column>
                                            <asp:HyperLinkColumn Text="&lt;img src=image/dir_pointer_g.gif border=0&gt;"></asp:HyperLinkColumn>
                                          
                                            <asp:HyperLinkColumn Target="main" DataNavigateUrlField="mid" DataNavigateUrlFormatString="login.aspx?id={0}" DataTextField= '<%# FormatStringl(DataBinder.Eval(Container.DataItem,"url").ToString())%>' >
                                                    <HeaderStyle HorizontalAlign="Center" Width="220px"></HeaderStyle>
                                                   
                                                </asp:HyperLinkColumn>
                                        <Column>
</asp:DataGrid>

如何显示在HyperLinkColumn中啊?高手帮忙!!
搜索更多相关主题的帖子: datagrid 字符 
2010-09-23 21:16
红色警戒
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:19
帖 子:444
专家分:2967
注 册:2005-11-20
得分:3 
C#代码
    public string SubStr(string sString, int nLeng)
    {
        if (sString.Length <= nLeng)
        {
            return sString;
        }
        string sNewStr = sString.Substring(0, nLeng);
        sNewStr = sNewStr + "...";
        return sNewStr;
    }

2010-09-25 08:03
cxwl3sxl
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:495
专家分:129
注 册:2005-11-12
得分:3 
传说中css可以很轻易的实现

努力,哈哈,总有一天会变成高手~~~~~~因为我相信:没有办不到,只有想不到!http://t..cn/fpress
2010-09-25 17:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-321179-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011769 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved