Replace characters in a Field when bindig data

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Replace characters in a Field when bindig data

    I have a drop down field on a form. When binding data to the DataValueField
    property of the drop down, I need to replace "&" with "%".

    In code behind I tried

    DataValueField='<%# DataBinder.Eval(Container.DataItem, "CATEGORY_VALUE")
    %>'

    I get the following error:

    Compiler Error Message: BC30456: 'DataItem' is not a member of
    'System.Web.UI.Control'.

    I tried DataSource in place of DataItem but similar error.
    Can somebody please help me?

    --


    Thank you.

    Satish Appasani
    #201, Wing - 1, Block - D
    Cyber Gateway
    Hyderabad - 500 081, India
    Phone: +91(40)2311-1356 Ext-122
    Mobile: +91(40)333-31032
    E-mail: [email]satish@vertexcs.com[/email]


    Satish Appasani Guest

  2. Similar Questions and Discussions

    1. Is there a way to replace characters in a string/array
      I am trying to find a function similar to php's str_replace is there something that will allow me to replace a certain character in a variable? ...
    2. SQL Where lenght of data in field GT 'n' characters
      Need a sql where statement to pull only records where field 'ABC' contains more than 2 characters (nvarchar 255 field)
    3. find replace a range of characters
      I need to find and replace a range of characters that are contained in brackets like below: It seems the brackets are throwing me off. I just...
    4. Using Replace function to remove two different characters
      I'm using replace function to strip 0s from a particular string: <%=replace(rs1("racelength"),"0","''"%> but I need to also strip empty spaces...
    5. Replace * with return characters?
      Is there a way to do this or not? I want to import a file with return characters but it seems impossible. even with the new find/replace...
  3. #2

    Default Replace characters in a Field when bindig data

    Hi

    My guess is you should replace values in sql query itself.


    Ravikanth

    >-----Original Message-----
    >I have a drop down field on a form. When binding data to
    the DataValueField
    >property of the drop down, I need to replace "&"
    with "%".
    >
    >In code behind I tried
    >
    >DataValueField='<%# DataBinder.Eval
    (Container.DataItem, "CATEGORY_VALUE")
    >%>'
    >
    >I get the following error:
    >
    >Compiler Error Message: BC30456: 'DataItem' is not a
    member of
    >'System.Web.UI.Control'.
    >
    >I tried DataSource in place of DataItem but similar
    error.
    >Can somebody please help me?
    >
    >--
    >
    >
    >Thank you.
    >
    >Satish Appasani
    >#201, Wing - 1, Block - D
    >Cyber Gateway
    >Hyderabad - 500 081, India
    >Phone: +91(40)2311-1356 Ext-122
    >Mobile: +91(40)333-31032
    >E-mail: [email]satish@vertexcs.com[/email]
    >
    >
    >.
    >
    Ravikanth[MVP] Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139