昨天我正在做某事,发现 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);
}
-感谢您宝贵的时间。