This is a migrated thread and some comments may be shown as answers.

Telerik Controls not working after Overriding Page Render

1 Answer 46 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Krishna
Top achievements
Rank 1
Krishna asked on 19 Mar 2013, 02:25 PM

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.

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 22 Mar 2013, 01:13 PM
Hi Krishna,

The code snippet you posted appears to be correct and it should not affect RadControls for ASP.NET AJAX on the page. Please send a simple, fully runnable project that isolates the issue so that we can inspect it locally and provide a more to the point answer.

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Krishna
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or