Telerik Controls not working after Overriding Page Render

2 posts, 0 answers
  1. Krishna
    Krishna avatar
    1 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2013 Link to this post

    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.
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 22 Mar 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top