Surrounding Eval with html tags

bullvidema

New Member
Please please help!! I've been searching this for hours but maybe the solution is so obvious I'm completely overlooking it :(I have a listview that binds to a sql table. The table contains a bunch of fields that hold only 'T' or NULL values, except for the last two fields which hold free-type text for user comments.For the T/NULL values - The listview is configured so that an empty cell will not display, and where there is a 'T' value, it will instead show a custom text and create a line break for the next item. This syntax does exactly that: \[code\]<asp:Label ID="LymeLabel" runat="server" Text='<%# Eval("Lyme","Lyme Disease<br />") %>' />\[/code\]However, I want the last two fields (the free-type text) do display in a paragraph style, with paragraph tags surrounding the Eval statement. The tags have to form part of the Eval so that they won't render whitespace if the cells are empty. My thinking was to do it this way but it doesn't work - the whitespace shows up either way:\[code\]<asp:Label ID="OtherCommentLabel" runat="server" Text='<%# "<p>"+Eval("OtherComment")+"</p>" %>' />\[/code\]I'm guessing the " "+ ... +" " doesn't care what's in or not in the middle.. but how to fix it? There must be a very simple solution to this and I feel really stupid even asking this. Any advice please?
 
Back
Top