昨天我做了一些事情,并在覆盖页面渲染时立即发现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);
}
- 谢谢你宝贵的时间。