Replacing characters in datagrid

Discussion in 'ASP .Net Web Controls' started by Tony, Sep 25, 2003.

  1. Tony

    Tony Guest

    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();

    // ----------------
    Tony, Sep 25, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BenO
    Replies:
    0
    Views:
    353
  2. Robert Brewer

    RE: Replacing "illegal characters" in html

    Robert Brewer, May 9, 2004, in forum: Python
    Replies:
    0
    Views:
    573
    Robert Brewer
    May 9, 2004
  3. Mike

    Replacing utf-8 characters

    Mike, Oct 5, 2005, in forum: Python
    Replies:
    8
    Views:
    488
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Oct 5, 2005
  4. Johhny
    Replies:
    10
    Views:
    674
    Fredrik Lundh
    Jan 26, 2006
  5. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    256
    Chris Hohmann
    Apr 11, 2005
Loading...

Share This Page