Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 19, 2011 02:50 PM by Ronklod
0 Points
1 Post
Dec 19, 2011 02:50 PM|LINK
Hi,
We have migrated our web site to .net 4.0.
We have encountered the following issues:
1. HtmlTextWriter
We have the following code which runs fine with previous versions of .net, but with version 4.0 something is wrong:
writer.AddAttribute("onDrop", @"FnChkDragStr('[^" + sDecimalSeparator + @\\d]', false));
When this is being rendered we get the following result:
ondrop="FnChkDragStr('["]', false)"
I know we can fix this by doing the following:
writer.AddAttribute("onDrop", @"FnChkDragStr('[^" + sDecimalSeparator + @\\d]', false),false);
so I have 2 questions:
1. Is there a general way to fix this for the entire web site? (Since otherwise we need to fix every line that uses the AddAttribute method.
2. Why was that changed?
2. InnerText property.
We have a similar problem here. We have the following code:
HtmlGenericControl oScript1 = new HtmlGenericControl("script");
oScript.InnerText = @"document.getElementById('" + "ddd" + @"').style.backgroundColor='red';";
when this is being rendered we get the following result:
<script>document.getElementById('ddd').style.backgroundColor='red'</scriptT>
I read in MSDN about the InnerText property and it says that it automatically does HTML encoding
And if we don’t want it to automatically do HTML encoding we should use InnerHTML.
So my questions here are:
1. Why was the behavior changed from previous versions of .net?
2. Is there a way to keep the old behavior by some configuration change?
Ronklod
0 Points
1 Post
migration to .net 4.0
Dec 19, 2011 02:50 PM|LINK
Hi,
We have migrated our web site to .net 4.0.
We have encountered the following issues:
1. HtmlTextWriter
We have the following code which runs fine with previous versions of .net, but with version 4.0 something is wrong:
writer.AddAttribute("onDrop", @"FnChkDragStr('[^" + sDecimalSeparator + @\\d]', false));
When this is being rendered we get the following result:
ondrop="FnChkDragStr('["]', false)"
I know we can fix this by doing the following:
writer.AddAttribute("onDrop", @"FnChkDragStr('[^" + sDecimalSeparator + @\\d]', false),false);
so I have 2 questions:
1. Is there a general way to fix this for the entire web site? (Since otherwise we need to fix every
line that uses the AddAttribute method.
2. Why was that changed?
2. InnerText property.
We have a similar problem here. We have the following code:
HtmlGenericControl oScript1 = new HtmlGenericControl("script");
oScript.InnerText = @"document.getElementById('" + "ddd" + @"').style.backgroundColor='red';";
when this is being rendered we get the following result:
<script>document.getElementById('ddd').style.backgroundColor='red'</scriptT>
I read in MSDN about the InnerText property and it says that it automatically does HTML encoding
And if we don’t want it to automatically do HTML encoding we should use InnerHTML.
So my questions here are:
1. Why was the behavior changed from previous versions of .net?
2. Is there a way to keep the old behavior by some configuration change?