How can I make my Chart Web Part look good when I use it with lookup fields?

The issue I have is that the chart displays the field id along with its value. For example, it displays "2;#Bing" when I'd like to see only "Bing".

2 Answers 2


you can use xpath to do that, for example /dsQueryResponse/Rows/Row[substring-after(@field., '#')

But that has to be done in a dataview that displays a content source in your page

Another way would be to use javascript or jquery to split the text of a paragraph or a div for example with a specific id Hope that helps



I have mention how to split values in your chart web part,

foreach (DataRow item in dt.Rows)
   if (!string.IsNullOrEmpty(item["YourItemname"].ToString()) && item["yourItemname"].ToString().Contains("#"))

   item["YourItemname"] = item["YourItemname"].ToString().Split('#')[1];

Hope this answers is very helpful for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.