Search code examples
c#asp.netinternet-explorer-9

Ghost cell in IE9 with Repeater Control


IE9 Generate blank cell or you can say Ghost Cell, with ASP.Net Repeater control. I try javascript regural expression. Render function to run reg. exp. but the page holds few update controls and generate error.

Error: sys.webforms.pagerequestmanagerservererrorexception the message received from the server could not be parsed. ScriptResource.axd

I try all the well known links for this error. Please suggest me if you really have...

Thank You

protected override void Render(HtmlTextWriter writer)
    {
      using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
      {
        base.Render(htmlwriter);
        string html = htmlwriter.InnerWriter.ToString();
         if ((ConfigurationManager.AppSettings.Get("RemoveWhitespace") + string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase))
          {
            //html = Regex.Replace(html, @"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}", string.Empty);
            html = Regex.Replace(html, @"(?<=<td[^>]*>)(?>\s+)(?!<table)|(?<!</table>\s*)\s+(?=</td>)", string.Empty);
            html = html.Replace(";\n", ";");
          }
         writer.Write(html.Trim());
      }

another Solution is, but fail for Repeater

var expr = new RegExp('>[ \t\r\n\v\f]*<', 'g'); 
document.body.innerHTML = document.body.innerHTML.replace(expr, '><'); 

Solution

  • You can access the Repeater control directly (before it's written to the page and rendered by IE) and remove the cells based on their index.