SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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".

share|improve this question

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


share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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