DetailsView Converts '<' & '>' to '&lt;' & '&gt;'

I have multi-line textboxes from which the data is stored as a text value in the SQL database. Before the data is passed to the stored procedure, the text is parsed to replace all vbNewLIne and vbLf cases with "<br/>". This is done successfully, storing the text in the database with the "<br/>" tags.

When the data is displayed, I want the text data dropped into the page as is; meaning "<br/>" in the database appears as "<br/>" in the source. However, the DetailsView object into which the values are being passed seems to be translating the "<br/>" into "&lt;br/&gt;" in the source. The data is being passed to the DetailsView object via an ObjectDataSource which effectively generates a dynamicly defined SQL command to request the data.

 How do I go about preventing this symbol translation?

 Thanks,

 Syn

0
Syn
10/9/2006 9:33:11 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

4 Replies
891 Views

Similar Articles

[PageSpeed] 37

Still would like some help if anyone can find it. I could not find a case and solution similar to this in my searches.

 Thanks

0
Syn
10/9/2006 2:12:39 PM

Hi,Syn:

You many use a helper function to deal with it. 

<asp:TextBox ID="TextBox2" runat="server" Text='<%# Filter(DataBinder.Eval(Container.DataItem,"name").ToString())%>' ></asp:TextBox>

public static string Filter(string text1)
    {
        StringBuilder strBuilder = new StringBuilder();
        strBuilder.Insert(0, text1);
        strBuilder.Replace(((char)32).ToString(), "&nbsp;");
        strBuilder.Replace(((char)9).ToString(), "&nbsp;");
        strBuilder.Replace(((char)34).ToString(), "&quot;");
        strBuilder.Replace(((char)39).ToString(), "&#39;");
        strBuilder.Replace(((char)13).ToString(), " ");
        strBuilder.Replace(((char)10).ToString() + ((char)10).ToString(), "</P><P>");
        strBuilder.Replace(((char)10).ToString(), "<BR>");
        if (strBuilder.Length > 10)
        {
            return strBuilder.ToString().Substring(0, 10);
        }
        else return strBuilder.ToString();
    }




Best Regards,
__________________________________________________
Sincerely,
Rex Lin
Microsoft Online Community Support

This posting is provided "AS IS" with on warranties, and confers no rights.
0
rexlin
10/10/2006 8:29:04 AM

Hi Rex and everyone else,

While this idea would work for a bound text box, I'm not sure how it could be applied to the following:

        <asp:ObjectDataSource ID="ToolDetailsDB"
            runat=server
            selectmethod="SelectMethod"
            UpdateMethod="UpdateMethod"
            OldValuesParameterFormatString="original_{0}"
            EnableViewState=false
            typename="FunctionsPassdown.PassdownToolInfoData"
            DataObjectTypeName="FunctionsPassdown.PassdownInfoDataObject.Data">
            <SelectParameters>
                <asp:ControlParameter PropertyName="Text" Type="Int32" Name="intPassdownID" ControlID="content_tool$hfPassdownID"></asp:ControlParameter>
                <asp:ControlParameter PropertyName="SelectedValue" Type="Int32" Name="intPassdownToolStateID" ControlID="ToolPassdown"></asp:ControlParameter>
            </SelectParameters>
            <UpdateParameters>
                <asp:ControlParameter PropertyName="Text" Type="Int32" Name="intPassdownID" ControlID="content_tool$hfPassdownID"></asp:ControlParameter>
                <asp:ControlParameter PropertyName="SelectedValue" Type="String" Name="strTool" ControlID="ToolPassdown"></asp:ControlParameter>
            </UpdateParameters>
        </asp:ObjectDataSource>
                
        <asp:DetailsView ID="ToolDetails"
            runat=server
            DataSourceID=ToolDetailsDB
            AutoGenerateRows=true
            CssClass="list"
            Width="400px"
            AutoGenerateEditButton=true>
            <RowStyle CssClass="row" Wrap=true />
            <AlternatingRowStyle CssClass="alt" />
            <FieldHeaderStyle CssClass="header" Width="100px" />
            <CommandRowStyle CssClass="command" />
            <HeaderTemplate>
                <tr><th colspan=2> </th></tr>
            </HeaderTemplate>
        </asp:DetailsView>

 Since this is an auto-generated list, I am unclear how this could be applied. If I staticly defined the rows (or columns for the corresponding parent GridView), this idea would work. Unfortunately, the rows and collumns are dynamically defined by the structure of the database itself (dynamic storage items, etc...).

 Is there a way to disable the filtering the DetailsView and GridView objects do to the incoming values which translate the '<' and '>' chars, or a way to apply what you listed above to the DetailsView and GridView objects?

Thanks, -syn

0
Syn
10/11/2006 7:48:27 AM

Still hoping for some help, if anyone has any ideas. Thanks much.

 -Syn

0
Syn
10/16/2006 1:37:19 PM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Why 'and' not '&&' ? (was Cleaning up 'uninitialized value')
> Use: > > if (@ARGV and -T $ARGV[0]) { ... } Just wondering if there is a reason for using the lower precedence 'and' here instead of '&&'? I haven't been finding many uses for 'and' which tells me I might not fully understand it. Thanks, Peter C. On May 30, Peter Cornelius said: >> if (@ARGV and -T $ARGV[0]) { ... } > >Just wondering if there is a reason for using the lower precedence 'and' >here instead of '&&'? I haven't been finding many uses for 'and' which >tells...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'To', 'CC', & 'BCC'
Name: Dick Tracy Email: philipdottracyatoptusnetdotcomdotau Product: Thunderbird Summary: 'To', 'CC', & 'BCC' Comments: I have just started using Thunderbird and while I find it quite excellent- I suggest having a button to add addressees to 'BCC' as well. Currently each 'BCC' addressee has to be selected manually. I send e-mail to quite a number of people at a time and I do not wish to readily spread others addresses easily. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0....

Assigning '<' & '>' as chars to a variable
Okay, I surrender...what's the trick to assigning the greater-than (<) and the less-than (>) symbols, as characters, to a variable without triggering all sorts of unwanted "Perlish" behavior? I want to do something on the order of: $var1 = 'This is text '; $var2 = 'This is more text'; $target = $var1.'<'.$var2.'>'; so that I can finally do: print $target; ## or otherwise manipulate the $target variable and be able to see this result: This is text <This is more text> I've tried "escaping&q...

Give access to non virtual folder through configuration entry? ERROR: <location> path attribute must be a relative virtual path. It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|'.
I have a webpage running under a virtual directory that is mapped to d:/webapplication that produces an excel spreadsheet, the page calls a library object that generates a report and places it in a folder d:/attachments. This folder is not in the virtual directory. When I access the webpage i click a button and it attemps to return the created spreadsheet as a mim content type application/vnd.ms-excel. However i getting redirected back to the login page of the application. Ive also noticed that the excel spreadsheet has not even been created at this location. So assuming this...

Precedence Question ('and' vs '&&')
Basic question on using '&&' vs 'and'. I see that '&&' has higher precedence than 'and', but why does print 1 && 1 && 0; print "\n"; print 1 and 1 and 0; print "\n"; return 0 1 I would have expected both statements to return 0. Thanks Jeff __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ > Basic question on using '&&' vs 'and'. I see that '&...

Linq to XML
Hi, I have this linq statement: IEnumerable<Room> roomsList = (from room in parent.Descendants("room")where room.Element("sleeps").Value == "2"&& room.Element("rate").Element("price").Value != "Full" the 'parent' bit above is an XElement - http://xmlfeed.laterooms.com/index.aspx?aid=3998&rtype=7&sdate=2008-07-22&nights=4&hids=149455,124561,4851,92536,85964,121511,7456,3244,142397,87208,145391,145340,88026,147544,91385,71752,73224,4721,1393,100204,93523,72858,69789,149598,86922,149596,89064,7...

Operator '&&' cannot be applied to operands of type 'bool' ... 'string'"
Hi friends .I get the following error for this line of code "if (QSDealID = (dr.GetString(1) && ((tt.TotalSeconds)<= 15) && (ip) = dr.GetString(4)))"  error:Operator '&&' cannot be applied to operands of type 'bool' ... 'string'" I need ur urgent help...Gurjeet,England Hi There, Im not 100% know what variable you have here, but i guess this is what you trying to do: if ( (QSDealID == dr.GetString(1)) && ( tt.TotalSeconds <= 15) && (ip == dr.GetString(4)) ) Equal operand in C# is == NOT = Hope...

The type '<class>' exists in both '<dll location>' and '<dll location 2>'
Hi. Has anyone come across this problem upgrading VS2003 to VS2005:The type '<class>' exists in both '<dll location>' and '<dll location 2>' Thanks! Hi TinaFMills,   Did you finish the process of migrate project form 2003 to 2005?   The error message means duplicate class name in different locations. Such as aspx pages, user controls, custom controls and so on. Please load the solution in Visual Studio IDE try to find the duplicate class. Edit->File and Replace->Find In Files (look in entire solution)    Sincerely,Benson YuMicrosoft Online...

The type '<class>' exists in both '<dll location>' and '<dll location 2>'
For some reason though it appears that one of my class files (_common.cs - in the App_Code directory) is being included in the WAP .dll file as well as when it compiles the App_Code at runtime.error CS0433: The type 'inlinehockey._common' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\25321638\9b5c4b00\assembly\dl3\3657f4e6\cd91aef5_4d5cc601\inlinehockey.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\25321638\9b5c4b00\App_Code.xad_ajc1.dll'  The error was not knowing what dll to use for the type w...

superreview granted: [Bug 286926] && should be & in nsMsgDBView::ToggleExpansion : [Attachment 178041] Patch changing '&&' to '&'
David Bienvenu <bienvenu@nventure.com> has granted Jean-Francois Ducarroz <ducarroz@ducarroz.org>'s request for superreview: Bug 286926: && should be & in nsMsgDBView::ToggleExpansion https://bugzilla.mozilla.org/show_bug.cgi?id=286926 Attachment 178041: Patch changing '&&' to '&' https://bugzilla.mozilla.org/attachment.cgi?id=178041&action=edit ...

superreview requested: [Bug 286926] && should be & in nsMsgDBView::ToggleExpansion : [Attachment 178041] Patch changing '&&' to '&'
Jean-Francois Ducarroz <ducarroz@ducarroz.org> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 286926: && should be & in nsMsgDBView::ToggleExpansion https://bugzilla.mozilla.org/show_bug.cgi?id=286926 Attachment 178041: Patch changing '&&' to '&' https://bugzilla.mozilla.org/attachment.cgi?id=178041&action=edit ...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

Web resources about - DetailsView Converts '<' & '>' to '&lt;' & '&gt;' - asp.net.presentation-controls

Resources last updated: 12/20/2015 12:29:52 PM