Hi,
I use HtmlBuilder to get an Image map as a string and pass it to the client browser but are having some difficulties.
First this is how I use the HtmlBuilder class:
HtmlBuilder hb = new HtmlBuilder(_flc);
map = hb.CreateImageMap("chart");
This string is returned and assigned in another class to a attribute of that class, imgMap. Here is how I want to "print to screen", Note phImageMap is a PlaceHolder instance on the custom control also containing the image of the graph:
LiteralControl ltc = new LiteralControl();
ltc.Text = imgMap;
phImageMap.Controls.Add(ltc);
The first problem came when the string returned contained some escape characters, for example:
"\t<MAP NAME=\"chart\">\r\n
\t\t<AREA SHAPE=\"RECT\" COORDS=\"316,182,366,232\"\r\n
\t\t\tHREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=28\" TARGET=\"_self\" TITLE=\"\">\r\n
\t\t<AREA SHAPE=\"RECT\" COORDS=\"316,32,366,82\"\r\n
\t\t\tHREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=27\" TARGET=\"_self\" TITLE=\"\">\r\n
\t\t<AREA SHAPE=\"RECT\" COORDS=\"166,257,216,307\"\r\n
\t\t\tHREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=26\" TARGET=\"_self\" TITLE=\"\">\r\n
\t\t<AREA SHAPE=\"RECT\" COORDS=\"166,107,216,157\"\r\n
\t\t\tHREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=25\" TARGET=\"_self\" TITLE=\"\">\r\n
\t\t<AREA SHAPE=\"RECT\" COORDS=\"16,182,66,232\"\r\n
\t\t\tHREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=24\" TARGET=\"_self\" TITLE=\"\">\r\n
\t</MAP>\r\n"
Now this project is using DOTNETNUKE and it seems that the html generating modules did not like these, so I wrote some regexp to clean those out.
Now at this point when I take the value of the string variable that gets passed(that is cleaned) and explicitly print that, example:
phImageMap.Controls.Add(new LiteralControl("<MAP NAME=\"chart\"><AREA SHAPE=\"RECT\" COORDS=\"316,32,366,82\" HREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=28\" TARGET=\"_self\" TITLE=\"\"><AREA SHAPE=\"RECT\" COORDS=\"166,332,216,382\" HREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=27\" TARGET=\"_self\" TITLE=\"\"><AREA SHAPE=\"RECT\" COORDS=\"166,182,216,232\" HREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=26\" TARGET=\"_self\" TITLE=\"\"><AREA SHAPE=\"RECT\" COORDS=\"166,32,216,82\" HREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=25\" TARGET=\"_self\" TITLE=\"\"><AREA SHAPE=\"RECT\" COORDS=\"16,182,66,232\" HREF=\"/fburg/Default.aspx?TabId=523&CtrlView=ProcessSummary&ProcessId=10&ProcessGraphImage=Show&id=24\" TARGET=\"_self\" TITLE=\"\"></MAP>"));
the image map is generated over the image and it works very well. But when I assign the the variable "imgMap"(like showen in the second code snipped) it does not generated the image map.
Now I have two questions. The first is if there is a way to make HtmlBuilder not generate the string with all the escape characters etc? I did not see anything of the kind in the documentation. The second question is if someone can point me at the weird string assignment problem? I know this is likely something very silly but we can't find the problem.
Kind Regards.