Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 重写页面呈现后Telerik控件不工作_Asp.net_Ajax_Telerik_Telerik Grid - Fatal编程技术网

Asp.net 重写页面呈现后Telerik控件不工作

Asp.net 重写页面呈现后Telerik控件不工作,asp.net,ajax,telerik,telerik-grid,Asp.net,Ajax,Telerik,Telerik Grid,昨天我在做一些事情,发现Telerik控件在覆盖页面呈现时出现了这种意外行为。当我编写了以下代码时,我发现网格排序和telerik ajax无法工作。 如果有人知道下面的代码段为什么会发生这种情况,我将不胜感激 protected override void Render(HtmlTextWriter writer) { // setup a TextWriter to capture the markup TextWriter tw = new StringWriter()

昨天我在做一些事情,发现Telerik控件在覆盖页面呈现时出现了这种意外行为。当我编写了以下代码时,我发现网格排序和telerik ajax无法工作。 如果有人知道下面的代码段为什么会发生这种情况,我将不胜感激

  protected override void Render(HtmlTextWriter writer)
{
    // setup a TextWriter to capture the markup
    TextWriter tw = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(tw);
    // render the markup into our surrogate TextWriter
    base.Render(htw);
    // get the captured markup as a string
    string pageSource = tw.ToString();
    MatchCollection matches = Regex.Matches(pageSource, @"\[\!\[(.*?)\]\!\]");
    List<string> finishedCaptures = new List<string>();
    // Use foreach loop.
    foreach (Match match in matches)
    {
        foreach (Capture capture in match.Captures)
        {
            if (!finishedCaptures.Contains(capture.Value))
            {
                pageSource = pageSource.Replace(capture.Value, ConfigFactory.Instance[capture.Value.Trim(new char[] { '[', ']', '!' })]);
                finishedCaptures.Add(capture.Value);
            }
        }
    }
    writer.Write(pageSource);
}

-感谢您宝贵的时间。

您确定没有任何意外后果,即正则表达式匹配了不应该匹配的内容,然后替换了它吗?你想匹配的值是什么?你想匹配的值是什么?我确信它们不是。。。