sharepoint 2010 - How to format person or group field values in c#? -


i retrieving sharepoint list data in c# , assigning spgridview. below code using fill spgridview. have column called "contact" in spgridview, mapped person or group field.

after binding, when see "contact" column in spgridview, see results "kumar, ramesh;#55;#kumar, amit". want result "kumar, ramesh;kumar, amit".

please me how achieve this.

public void btnsearch_click(object sender, eventargs e) {             splist mylist = spcontext.current.web.lists["mylist"];             spquery query = new spquery();              query.query = @"<where>       <and>          <eq>             <fieldref name='year_x0020_start' />             <value type='text'>2010</value>          </eq>          <eq>             <fieldref name='year_x0020_end' />             <value type='text'>2012</value>          </eq>       </and>    </where>";              datatable temptbl = mylist.getitems(query).getdatatable();             gdvsearchresults.datasource = temptbl;             gdvsearchresults.databind(); } 

thanks in advance.!

i had similar problem under different circumstance. using content query web part , editing xsl template. same #55, etc showing up. got rid of using regular expression via javascript. possibly same on datatable column before bound spgridview. regular expression used was:

.replace(/[;#0-9]+/g, "; ") 

i blogged here: http://davidpopdan.blogspot.com/2012/11/using-people-picker-with-multiple-names.html

also, if you're wondering numbers are, they're user's id, unique site collection you're working in. there's hidden list keeps track of info.


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -