Results 1 to 5 of 5

Thread: Editing display data in databound listbox ... - RESOLVED

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33

    Editing display data in databound listbox ... - RESOLVED

    Hello,

    I have a databound list box that I created in design time. The info it displays uses HTML codes for apostrophies etc. I simply want to do a replace on the data - replace ' with single quotes - only on whats displayed - not the actual data.

    Any ideas on how I can accomplish this??

    Thanks,

    Rich
    Last edited by Richdef; May 8th, 2003 at 03:23 PM.
    Rich J Defilippo

  2. #2
    Lively Member
    Join Date
    Jan 2001
    Location
    Worcester, MA
    Posts
    77
    You mean like this?
    Code:
                Dim ds2 As SqlDataReader
                ds2 = dsLogin2.ExecuteReader()
                Dim ddlist as new DropDownList
                Dim le As New ListItem
    
         Do While ds.read()
                With le
                    .Text = replace(ds("xfield").tostring(),"searchFor","replacewith")
                    .value=ds("xfield").tostring()
                End With
                ddlist.Items.Add(le)
        loop
    
                ds2.Close()
                myConnection2.Close()
    "Find all you need in your mind if you take the time" -DT

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33
    I'm trying to translate your VB code to C#.

    I thought I would try to do this is C# arrrghhh - should have stayed with VB!!

    Any idea how this would work in C#??
    Rich J Defilippo

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33

    C# -- Replace text in Databound list box created in design time - RESOLVED

    This worked!!:

    Code:
    foreach (ListItem Le in lstbxAvailProds.Items)
    Le.Text = Le.Text.Replace("'","'");
    -Rich
    Rich J Defilippo

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33
    Thanks CinOs3,

    Your suggestion put me on the right track!!

    -Rich
    Rich J Defilippo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width