Yesterday I was doing something and found this unexpected behavior with the Telerik controls as soon as override the page render. I see the grids sorting and telerik ajax not working when I have coded the following code.
I would really appreciate if any one has clue why this is happening for the following code snippet.
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);
}
-Thanks for your precious time.