Replacing characters in datagrid

T

Tony

Dear all,

I'm using a datagrid in a c# asp.net page to display data
from a dataset populated from my SQL Server. So far, so
good! :)

The grid contains a "Problem Description" field which
contains carriage returns etc which are not displayed on
the page when the datagrid is rendered.

I've had an attempt to modify the string using the replace
method but so far no luck (see below). Any ideas on where
I'm going wrong?

Cheers
Tony

// ----------------

// create the dataset and fill it
DataSet ds = new DataSet();
myCommand.Fill(ds);


for(int i=0;i < ds.Tables[0].Rows.Count-1 ; i++)
{
strReplaced = ds.Tables[0].Rows["Problem
Description"].ToString();
strReplaced = strReplaced.Replace("\n","<br>");
}

MasterGrid.DataSource = ds;
MasterGrid.DataBind();

// ----------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top