I am using an asp:gridview to display a golf lesson schedule. I have three columns in the gridview (see image gridview.png) - Series (a concatenation of the series name, target golfer level, description), Dates (concatenation of Weekday with time, can have multiple dates for the series), Location/price (course location / price). I am retrieving the data from a database and formatting the results into strings. Each of the strings are dynamic. There can be one class or there can be 5 classes.
strSeriesSummary = "Swing Tune Up Series~(for golfers with some experience)~One and a half hours, covering short game and full swing techniques"
strDateTimeSummary = "Saturday, 10:00 AM - 11:30 AM~ - Chipping & Full Swing Mar 12~ - Pitching & Full Swing Mar 19~ - Sand & Full Swing Apr 2"
strLocationPriceSummary= "Red Wing Lake Golf Course~$25.00 per session"
I am trying to get a VBCRLF where the tilde (~) is in the string. Research indicates that asp.net does not like VBCRLF or any CRLF.
- I have tried replacing the CRLF with <br/> - the result is that the <br/> is displayed as part of the string - as in "Red Wing Lake Golf Course<br/>$25.00 per session"
- I have tried using Chr(13) & Chr(10) - no luck - translates to spaces
- I have tried code in the DataBound method of the gridview to replace the "~" with VBCRLF
t = gvRow.Cells(cellCount).Tex
- I have tried placing the <pre> tag in front of the grid - this, combined with the code in the gridview DataBound method, accomplishes the desired format but inserts a huge gap before the grid; I have researched getting rid of that gap but the results did not work for me.
- I have tried a templatefield with no luck - but perhaps I did it incorrectly
I have included the gridview code here, an image of what the grid looks like currently (gridview.png) and an image of what I am trying to accomplish.
I have spent too much time on this and have seen other posts in different resources regarding the issue of line breaks in grid views but have not seen a solid solution or one that addresses this particular scenario.
I will award points for an actual solution and for assistance.
AlternatingRowStyle-ForeColor ="#000066" >
<asp:BoundField DataField="ID" ReadOnly="True" HeaderText="ID" Visible="False" ></asp:BoundField>
<asp:BoundField DataField="SeriesSummary" ReadOnly="True" HeaderText="Series" Visible="True" ItemStyle-Wrap="true" ItemStyle-Width="170px">
<asp:BoundField DataField="DayDateSummary" ReadOnly="True" HeaderText="Dates" Visible="True" ItemStyle-Width="210px" ></asp:BoundField>
<asp:BoundField DataField="LocationPriceSummary" ReadOnly="True" HeaderText="Location/Price" ItemStyle-Width="150px" ></asp:BoundField>
<RowStyle Font-Size="X-Small" Font-Names="Arial" VerticalAlign="Top" HorizontalAlign="Justify" BackColor="#BCF989" Height="18px" ForeColor="#242AAD" ></RowStyle>
<AlternatingRowStyle BackColor="White" CssClass="txtLessonLarge" ForeColor="#000066"/>
<HeaderStyle BackColor="#42B617" Font-Bold="True" Font-Size="10pt" HorizontalAlign="Left" />
<PagerStyle Font-Names="Arial" Font-Size="X-Small" HorizontalAlign="Center" />