Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JavascriptCSSC#4.0
I have a datalist item i bind the week days. i put the comma in grid view in how to remove last comma only...
i write like this
<asp:DataList ID="dlstWeekDays" runat="server"  RepeatColumns="7" RepeatDirection="Horizontal" ;
    <ItemStyle Width="50px" Font-Size="12px"  />
    <ItemTemplate>                                            <%#Eval("Lookup.Code")%>,
  </ItemTemplate>
       </asp:DataList>
 

i get out put like this
Working days :

Monday, Tuesday, Wednesday, Thursday, Friday,
 
i want remove after "Friday" only not this "Friday,"
Posted 9-Nov-12 22:32pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

<%#Eval("Lookup.Code.TrimEnd(',')")%>,
  Permalink  
v2
Comments
KolliHari Chowdary at 10-Nov-12 4:55am
   
Sorry i get this error "DataBinding: 'System.String' does not contain a property with the name 'TrimEnd'".
aspnet_regiis -i at 10-Nov-12 4:58am
   
Seems , TrimEnd is not working when in declarative syntax. Then you will have to use TrimEnd at backend from where this Lookup.Code is returning the data. Use this in the code-behind
KolliHari Chowdary at 10-Nov-12 5:12am
   
in dlstWeekDays does not suppert can u give any eg like this
aspnet_regiis -i at 10-Nov-12 10:01am
   
Okay.. Tell me from where are you getting this "Lookup.Code" ..Show me the code related to this "Lookup.Code"
aspnet_regiis -i at 10-Nov-12 10:03am
   
If this is a property like this public Lookup.Code { return Lookup.Code ="Monday,...Friday," } Then I will fix it as public Lookup.Code { return Lookup.Code ="Monday,...Friday,".TrimEnd(','); }

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,518
1 OriginalGriff 478
2 Manas Bhardwaj 394
3 Tadit Dash 310
4 Damith Weerasinghe 260
0 Sergey Alexandrovich Kryukov 9,575
1 OriginalGriff 5,856
2 Peter Leow 4,405
3 Maciej Los 3,540
4 Abhinav S 3,513


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid