Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net VB.net Load a GridView cell with lines one under the other

Hi

I gave the following text in a SQL database that I load to an ASP.net GridView. It loads as one long string so I am the code further on to load it into a Template field so that the lines are one under each other. It doesn't seem to work

 1.       In your organisation's daily operations, would you say honesty is practiced:|

(A)       Always|
(B)       Frequently|
(C)       Occasionaly|
(D)       Rarely|



Private Sub GridView3_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView3.RowDataBound
        Try
            ' Required to ignore the header and footer rows
            If e.Row.RowType = DataControlRowType.DataRow Then
                Dim oNumberAnswers As String = CStr(e.Row.Cells(5).Text)
                Dim oQuestion As String = CStr(e.Row.Cells(3).Text)
                Dim arrSplit As Object = Split(oQuestion, "|")
                Dim S As String = S
                For i As Integer = 0 To UBound(arrSplit)
                    If S = "" Then
                        S = arrSplit(i)
                    Else
                        S = S & vbCrLf & arrSplit(i)
                    End If
                Next
                e.Row.Cells(1).Text = S
ASKER CERTIFIED SOLUTION
Avatar of Jesus Rodriguez
Jesus Rodriguez
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks