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: BC36637: The '?' character cannot be used here.
Source Error:
Line 201: </strong>
Line 202:
Line 203: <asp:Label ID="DescriptionLabel" runat="server" Line 204: Text='<%# Convert.ToString(Eval("Description")).Length > 385 ? Convert.ToString(Eval("Description")).Substring(0,385) + "..." : Convert.ToString(Eval("Description")) %>' />
Line 205:
Gracien
Member
42 Points
125 Posts
Read more
Nov 27, 2012 04:37 PM|LINK
I' trying to do "Read More"
These codes work in one website but not working when i paste them into another.
<asp:Label ID="DescriptionLabel" runat="server"
Text='<%# Convert.ToString(Eval("Description")).Length > 385 ? Convert.ToString(Eval("Description")).Substring(0,385) + "..." : Convert.ToString(Eval("Description")) %>' />
I'm getting this error message:
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: BC36637: The '?' character cannot be used here.
Source Error:
Line 201: </strong> Line 202: Line 203: <asp:Label ID="DescriptionLabel" runat="server" Line 204: Text='<%# Convert.ToString(Eval("Description")).Length > 385 ? Convert.ToString(Eval("Description")).Substring(0,385) + "..." : Convert.ToString(Eval("Description")) %>' /> Line 205:msmk
Participant
797 Points
180 Posts
Re: Read more
Nov 27, 2012 05:18 PM|LINK
I don't know if this will make a difference, but maybe try changing the code to:
<%# Eval("Description").ToString().Length > 385 ? Eval("Description").ToString().Substring(0,385) + "..." : Eval("Description") %>Thats the way I've seen it done usually.
Gracien
Member
42 Points
125 Posts
Re: Read more
Nov 27, 2012 05:43 PM|LINK
no sorry it's still giving the same error msg
OnoSendai
Participant
1144 Points
239 Posts
Re: Read more
Nov 27, 2012 05:59 PM|LINK
Gracien, i would bet that you're trying this code on a VB.NET project, while the original code is C#.
There's no (?) operator in VB.NET; instead, you need to use IIF (immediate IF - i can't recall if it exists on VB.NET) or rewrite the code to use IF.
Hope it helps!
sreejukg
All-Star
28177 Points
4214 Posts
Re: Read more
Nov 27, 2012 06:18 PM|LINK
Make sure both websites are using same language. the code may vary if you have different languages...
My Blog
oned_gk
All-Star
36048 Points
7358 Posts
Re: Read more
Nov 28, 2012 02:52 AM|LINK
VB or C#?
VB : IIF(Eval("Description").Length > 385,"A","B")
Suwandi - Non Graduate Programmer