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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top