Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
875
Unterminated String Constant error in webgrid
posted

Hey,

I have a user control I made that contains a webgrid.  This control is located in 2 places:  1 is within the content pane in a master page (we will call this Grid 1), and the other is just simply on a page by itself (Grid 2).  The grid contains a user control that has a tooltip that appears when a user puts their mouse over a certain part of the control.

A new requirement came in stating that this tooltip had to have 2 lines of text in it, so I put a line break in the tooltip, in a format similar to the following:

altText = "some text" & vbCr & "some more text"

After making this change, Grid 1 now no longer renders and I get a JavaScript error on the page:  "Error: Unterminated string constant".  All other controls in the content pane display fine.  However, Grid 2 does render ok and does not display the same error message.  If these grids are both identical (remember it's the same control being used on 2 different pages), what could be causing this JavaScript error to be generated?

Please help!!!

  • 875
    Verified Answer
    posted

    Well, I managed to resolve my own problem.  The issue was that, in the markup for the grid, I had set Browser="Xml".  I removed, this, and now the grid renders with multi-line tooltips everywhere like it should.

    I still don't understand why though, on one page one grid would work, while the exact same grid wouldn't work on another page.  I have a feeling that I had set the browser to XML for a reason but I've done a bit of testing and removing it doesn't seem to have caused an issue (so maybe I had already removed whatever functionality I had initially required the browser = xml for)

  • 875
    posted

    Ok, a bit of an update... I took the grid out of the master page and onto another one, that's not the issue.  I have solved the issue of the missing grid, however, the tooltips still aren't right.  I changed the creation of the tooltip to be:

    altText = "some text" & Environment.NewLine & "some more text"

    The JavaScript error is now gone, however, the tooltip on Grid 1 is not on 2 lines, but the tooltip on Grid 2 is.

    What could be causing this inconsistency?