我想做个限制吧招商名称那一列的数据做限制最多16个字节长度,汉字2字节
<asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataSourceID="SqlDataSourceMer6" ForeColor="#333333" 
            GridLines="None" Height="100%" Width="100%" 
            onrowdatabound="GridView5_RowDataBound">            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />            <Columns>
                <asp:HyperLinkField DataTextField="pname" HeaderText="招商名称    " 
                    DataNavigateUrlFields="pname" 
                    DataNavigateUrlFormatString="ShowDetalled.aspx?proj={0}" />
                <asp:BoundField DataField="Column1" HeaderText="日期" ReadOnly="True" 
                    SortExpression="Column1" >
                <ItemStyle Width="90px" />
                </asp:BoundField>
            </Columns></asp:GridView>protected void GridView5_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //for (int i = 0; i < GridView5.Rows.Count; i++)
        //{
        //        string s = GridView5.Rows[i].Cells[0].Text;
        //        string t = s;
        //        if (s.Length >= 14)
        //        {
        //            t = s.Substring(0, 14) + "...";
        //        }
        //        this.GridView5.Rows[i].Cells[0].Text = t;
        //        this.GridView5.Rows[i].Cells[0].ToolTip = t;
        //        写这段代码发现整个招商名称列都不显示数据了,空的
        //}
        if (e.Row.Cells[0].Text.Length > 16)
        {
            this.GridView5.Rows[0].Cells[0].Text = e.Row.Cells[0].Text.Substring(0, 16) + "…";
            //这个运行就报错 :     索引超出范围。必须为非负值并小于集合大小。参数名: index
        }
    }上面效果图我看了好多其他类似帖子,但是都没解决求助GridViewASP.NET