翻到最后一页就会出现下面的错误,而其它页均正常!请高手指点,谢谢!!!———————————————————————————————————————————————————————————————————————————索引和长度必须引用该字符串内的位置。参数名: length
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 索引和长度必须引用该字符串内的位置。参数名: length源错误:
行 9: </tr>
行 10: <tr>
行 11: <td height="25"><%# getComment( DataBinder.Eval(Container.DataItem, "Content"))%></td>
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.ArgumentOutOfRangeException: 索引和长度必须引用该字符串内的位置。参数名: length源错误:
行 9: </tr>
行 10: <tr>
行 11: <td height="25"><%# getComment( DataBinder.Eval(Container.DataItem, "Content"))%></td>
解决方案 »
- 求64位服务器下利用word组件生成word的权限配置方法及代码
- 最后个问题!!!
- 如何能在多行TextBox1中输入Tab键
- confirm弹框页面刷新
- 存储过程,如何取得参数字段的值?
- 哎,这些语句 不知道是哪里出了错
- 如何验证文本框中的内容是否全部为数字?
- SQL,按时间段统计加入和退出的人数的差值的问题? 很欢迎‘陕北吴旗娃’来看看
- C#图片去黑边
- 在VS.NET中用ASP.NET开发Web应用,那么FrontPage还能起到什么作用?
- vs2005装了 sp1或者web application site是否可以直接打开vs2003的项目?
- 怎么用asp.net实现语音和视频聊天程序(C#)
public string getComment(object Content)
{
string input = Content.ToString();
input = new Regex("\r\n", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex("<span[ ]{0,}(.)*?>", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex("</p>", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex("</span>", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex("<img[ ]{0,}(.)*?>", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex(" ", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex("<br>", RegexOptions.IgnoreCase).Replace(input, "");
input = new Regex("<[ ]{0,}(.)*?>", RegexOptions.IgnoreCase).Replace(input, "");
string[] strArray = base.Request.QueryString["keyword"].Split(new char[] { ' ' });
int index = 0;
Regex regex9 = new Regex("");
for (int i = 0; i < strArray.Length; i++)
{
if (strArray[i] != "")
{
input = new Regex(strArray[i], RegexOptions.Compiled | RegexOptions.IgnoreCase).Replace(input, "<font color=\"red\">" + strArray[i] + "</font>");
if (input.IndexOf(strArray[i]) > 0)
{
index = input.IndexOf(strArray[i]);
}
}
}
try
{
if (index >= 20)
{
return input.Substring(index - 20, 100);
}
if (input.Length >= 100)
{
return input.Substring(0, 100);
}
return input;
}
catch
{
return input.Substring(0, 100);
}
}