Try Now
More in this section

Forums / 3.x Pre-release forums (retired) / Problem with Polls

Problem with Polls

4 posts, 0 answered
  1. Ben Alexandra
    Ben Alexandra avatar
    215 posts
    15 Sep 2012
    28 Apr 2007
    Link to this post

    I'm getting an error with Polls.  When I go to create a new Poll, I get the following error:

    Compilation Error   
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.   
    Compiler Error Message: CS0117: 'object' does not contain a definition for 'Trim'  
    Source Error:  
    Line 46:                         <li class="title">  
    Line 47:                             <asp:Label ID="Label1" AssociatedControlID="questionText" Text="Question" runat="server"></asp:Label> 
    Line 48:                             <asp:TextBox runat="server" id="questionText" EnableViewState="true"   
    Line 49:                             TextMode="MultiLine" Text='<%# Eval("Text").Trim() %>'></asp:TextBox>                              
    Line 50:                             <span runat="Server" id="questionVal"></span> 
    Source File: C:\MySite\Sitefinity\Admin\ControlTemplates\Polls\PollsInsert.ascx    Line: 48   

    And I can't compile my project unless I remove ".Trim()" from:

    <asp:TextBox runat="server" id="questionText" EnableViewState="true" TextMode="MultiLine" Text='<%# Eval("Text").Trim() %>'></asp:TextBox> 

    Any ideas?


  2. Ben Alexandra
    Ben Alexandra avatar
    215 posts
    15 Sep 2012
    28 Apr 2007
    Link to this post
    I should mention that if I remove .Trim() it seems to work fine.  Is there any reason it can't always be like that?

    Ben Alexandra
  3. Sean
    Sean avatar
    271 posts
    31 May 2006
    30 Apr 2007
    Link to this post
    Hi Ben you need to convert the Eval from type Object to type String before it will recognise the Trim method.


    <%# Eval("Text").ToString().Trim() %>

  4. Vassil Daskalov
    Vassil Daskalov avatar
    261 posts
    18 May 2013
    02 May 2007
    Link to this post
    Hello Ben,

    It seems that the trim functionality here is something we omitted to remove from the template for which we apologize. Thanks a lot for letting us know.

    Kind regards,
    Vassil Daskalov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
4 posts, 0 answered