Page 1 of 1

Control html generation of WebChart

Posted: Sun Aug 03, 2008 6:38 pm
by 13046319
Is there any way to control how the <div> and <img> tags are generated by the WebChart. I'm using version 3.5.3105.20152 in an ASP.NET MVC project (no postbacks). The html tags produced by the WebChart are not valid xhtml, by default the tag looks like:

Code: Select all

<div  style=" z-index : 100; height:225px; width:420px" id=ctl00_ctl00> <IMG GALLERYIMG="no" SRC="/Charts/GetChart?Chart=ctl00_ctl00127001633533698533363664jpg" id="ctl00_ctl00img" Name="ctl00_ctl00img"  Border=0></div>
but i want it to look like this:

Code: Select all

<div class="webChart" id="ctl00_ctl00"><img src="/Charts/GetChart?Chart=ctl00_ctl00127001633533698533363664jpg" id="ctl00_ctl00img" name="ctl00_ctl00img" alt="My Web Chart" /></div>
Note, there are several differences:
-tags & attributes must be lowercase
-img tag must be closed
-alt attribute in image tag
-div using a class attribute instead of style
-attribute values must be in quotes

Thanks,
Bill

Posted: Sun Aug 03, 2008 8:43 pm
by 13046319
Nevermind.... I came up with a solution, I just created a class that inherits from WebChart and override the Render() method. It's not perfect since my render method only supports jpg images, session temp files, and no interactive scripts - but it will get the job done.

Bill