我正在尝试将记录添加到 sharepoint 2010 中的“链接”列表中。我想对添加项目进行验证。我是这样写的。
我试图停止输入任何包含 google 关键字的链接。下面的代码有什么问题吗。我正在为我的练习而做。我认为图像中的代码没有清楚地出现。我在这里写下来。
if (properties.AfterProperties["vti_url"].ToString().Contains("google"))
{
properties.ErrorMessage = "You should not enter the google";
properties.Cancel = true;
}
添加后properties.AfterProperties["URL"].ToString().Contains("google")
运行良好。但是我的错误页面看起来不太好。这是屏幕截图。这个问题该怎么办。