Murray Brown
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(sen der As Object, e As System.Web.UI.WebControls. GridViewRo wEventArgs ) 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
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(sen
Try
' Required to ignore the header and footer rows
If e.Row.RowType = DataControlRowType.DataRow
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER