Bryan Sebastian
Bryan Sebastian

Reputation: 423

Add <br> tag in asp.net gridview column data

I am working on gridview and I am binding the data from code behind

Dim dataTblRep As New DataTable Dim dataRowRep As DataRowdataRowRep = dataTblRep.NewRow

dataRowRep("Batch Number") = "Totals : "
dataRowRep("Batch details") = "A" & <br/> & "B"

dataRowRep("Completed Docs") = TotEntryCount
dataRowRep("Received Docs") = TotSrcCount
dataTblRep.Rows.Add(dataRowRep)

gvRepOutput.DataSource = dataTblRep
gvRepOutput.DataBind()

So, in Batch details I am adding the two values from datatable and I want the "A" and "B" on seperate lines within the cell. But in the output I am getting "A <br/> B"

I have tried HtmlDecode but it is not working. Also, I am not using any Template Fields and I have the gridviews AutoGenerateColumns option set to True.

Upvotes: 1

Views: 3098

Answers (1)

Thomas
Thomas

Reputation: 64674

You need to use a Template column as BoundColumns HtmlEncode by default.

Upvotes: 1

Related Questions