Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Solution For Special Character in TextBox Multiline in Magic Ajax For .net 2.0

0.00/5 (No votes)
2 Jun 2006 1  
Solution For Problem in TextBox Multiline with Special Caracter in Magic Ajax For .net 2.0

Download source code - 12 Kb

Introduction

The Magic Ajax For .Net 2.0 have problem with Special values like (�,�,�,�,�,�,�) in Textbox Multiline after of post back where update this characters for Html Code like (� = ç | � = ñ). For solution this problem I updated the file AjaxPanel.cs for convert Html Code to Text.

Using the code

First:

I created a method called ConvertAsciiToText like code below:

protected String ConvertAsciiToText(String pValue)

{

pValue = pValue.Replace(" ", " ");

pValue = pValue.Replace("!", "!");

pValue = pValue.Replace(""", "\"");

pValue = pValue.Replace("#", "#");

pValue = pValue.Replace("$", "$");

pValue = pValue.Replace("%", "%");

pValue = pValue.Replace("&", "&");

pValue = pValue.Replace("'", "'");

pValue = pValue.Replace("(", "(");

pValue = pValue.Replace(")", ")");

pValue = pValue.Replace("*", "*");

pValue = pValue.Replace("+", "+");

pValue = pValue.Replace(",", ",");

pValue = pValue.Replace("-", "-");

pValue = pValue.Replace(".", ".");

pValue = pValue.Replace("/", "/");

pValue = pValue.Replace("0", "0");

pValue = pValue.Replace("1", "1");

pValue = pValue.Replace("2", "2");

pValue = pValue.Replace("3", "3");

pValue = pValue.Replace("4", "4");

pValue = pValue.Replace("5", "5");

pValue = pValue.Replace("6", "6");

pValue = pValue.Replace("7", "7");

pValue = pValue.Replace("8", "8");

pValue = pValue.Replace("9", "9");

pValue = pValue.Replace(":", ":");

pValue = pValue.Replace("&#59;", ";");

pValue = pValue.Replace("&#60;", "<");

pValue = pValue.Replace("&#61;", "=");

pValue = pValue.Replace("&#62;", ">");

pValue = pValue.Replace("&#63;", "?");

pValue = pValue.Replace("&#64;", "@");

pValue = pValue.Replace("&#65;", "A");

pValue = pValue.Replace("&#66;", "B");

pValue = pValue.Replace("&#67;", "C");

pValue = pValue.Replace("&#68;", "D");

pValue = pValue.Replace("&#69;", "E");

pValue = pValue.Replace("&#70;", "F");

pValue = pValue.Replace("&#71;", "G");

pValue = pValue.Replace("&#72;", "H");

pValue = pValue.Replace("&#73;", "I");

pValue = pValue.Replace("&#74;", "J");

pValue = pValue.Replace("&#75;", "K");

pValue = pValue.Replace("&#76;", "L");

pValue = pValue.Replace("&#77;", "M");

pValue = pValue.Replace("&#78;", "N");

pValue = pValue.Replace("&#79;", "O");

pValue = pValue.Replace("&#80;", "P");

pValue = pValue.Replace("&#81;", "Q");

pValue = pValue.Replace("&#82;", "R");

pValue = pValue.Replace("&#83;", "S");

pValue = pValue.Replace("&#84;", "T");

pValue = pValue.Replace("&#85;", "U");

pValue = pValue.Replace("&#86;", "V");

pValue = pValue.Replace("&#87;", "W");

pValue = pValue.Replace("&#88;", "X");

pValue = pValue.Replace("&#89;", "Y");

pValue = pValue.Replace("&#90;", "Z");

pValue = pValue.Replace("&#91;", "[");

pValue = pValue.Replace("&#92;", @"\");

pValue = pValue.Replace("&#93;", "]");

pValue = pValue.Replace("&#94;", "^");

pValue = pValue.Replace("&#95;", "_");

pValue = pValue.Replace("&#96;", "`");

pValue = pValue.Replace("&#97;", "a");

pValue = pValue.Replace("&#98;", "b");

pValue = pValue.Replace("&#99;", "c");

pValue = pValue.Replace("&#100;", "d");

pValue = pValue.Replace("&#101;", "e");

pValue = pValue.Replace("&#102;", "f");

pValue = pValue.Replace("&#103;", "g");

pValue = pValue.Replace("&#104;", "h");

pValue = pValue.Replace("&#105;", "i");

pValue = pValue.Replace("&#106;", "j");

pValue = pValue.Replace("&#107;", "k");

pValue = pValue.Replace("&#108;", "l");

pValue = pValue.Replace("&#109;", "m");

pValue = pValue.Replace("&#110;", "n");

pValue = pValue.Replace("&#111;", "o");

pValue = pValue.Replace("&#112;", "p");

pValue = pValue.Replace("&#113;", "q");

pValue = pValue.Replace("&#114;", "r");

pValue = pValue.Replace("&#115;", "s");

pValue = pValue.Replace("&#116;", "t");

pValue = pValue.Replace("&#117;", "u");

pValue = pValue.Replace("&#118;", "v");

pValue = pValue.Replace("&#119;", "w");

pValue = pValue.Replace("&#120;", "x");

pValue = pValue.Replace("&#121;", "y");

pValue = pValue.Replace("&#122;", "z");

pValue = pValue.Replace("&#123;", "{");

pValue = pValue.Replace("&#124;", "|");

pValue = pValue.Replace("&#125;", "}");

pValue = pValue.Replace("&#126;", "~");

pValue = pValue.Replace("&#127;", "");

pValue = pValue.Replace("&#128;", "�");

pValue = pValue.Replace("&#129;", "�");

pValue = pValue.Replace("&#130;", "�");

pValue = pValue.Replace("&#131;", "�");

pValue = pValue.Replace("&#132;", "�");

pValue = pValue.Replace("&#133;", "�");

pValue = pValue.Replace("&#134;", "�");

pValue = pValue.Replace("&#135;", "�");

pValue = pValue.Replace("&#136;", "�");

pValue = pValue.Replace("&#137;", "�");

pValue = pValue.Replace("&#138;", "�");

pValue = pValue.Replace("&#139;", "�");

pValue = pValue.Replace("&#140;", "�");

pValue = pValue.Replace("&#141;", "�");

pValue = pValue.Replace("&#142;", "�");

pValue = pValue.Replace("&#143;", "�");

pValue = pValue.Replace("&#144;", "�");

pValue = pValue.Replace("&#145;", "�");

pValue = pValue.Replace("&#146;", "�");

pValue = pValue.Replace("&#147;", "�");

pValue = pValue.Replace("&#148;", "�");

pValue = pValue.Replace("&#149;", "�");

pValue = pValue.Replace("&#150;", "�");

pValue = pValue.Replace("&#151;", "�");

pValue = pValue.Replace("&#152;", "�");

pValue = pValue.Replace("&#153;", "�");

pValue = pValue.Replace("&#154;", "�");

pValue = pValue.Replace("&#155;", "�");

pValue = pValue.Replace("&#156;", "�");

pValue = pValue.Replace("&#157;", "�");

pValue = pValue.Replace("&#158;", "�");

pValue = pValue.Replace("&#159;", "�");

pValue = pValue.Replace("&#160;", " ");

pValue = pValue.Replace("&#161;", "�");

pValue = pValue.Replace("&#162;", "�");

pValue = pValue.Replace("&#163;", "�");

pValue = pValue.Replace("&#164;", "�");

pValue = pValue.Replace("&#165;", "�");

pValue = pValue.Replace("&#166;", "�");

pValue = pValue.Replace("&#167;", "�");

pValue = pValue.Replace("&#168;", "�");

pValue = pValue.Replace("&#169;", "�");

pValue = pValue.Replace("&#170;", "�");

pValue = pValue.Replace("&#171;", "�");

pValue = pValue.Replace("&#172;", "�");

pValue = pValue.Replace("&#173;", "&shy;");

pValue = pValue.Replace("&#174;", "�");

pValue = pValue.Replace("&#175;", "�");

pValue = pValue.Replace("&#176;", "�");

pValue = pValue.Replace("&#177;", "�");

pValue = pValue.Replace("&#178;", "�");

pValue = pValue.Replace("&#179;", "�");

pValue = pValue.Replace("&#180;", "�");

pValue = pValue.Replace("&#181;", "�");

pValue = pValue.Replace("&#182;", "�");

pValue = pValue.Replace("&#183;", "�");

pValue = pValue.Replace("&#184;", "�");

pValue = pValue.Replace("&#185;", "�");

pValue = pValue.Replace("&#186;", "�");

pValue = pValue.Replace("&#187;", "�");

pValue = pValue.Replace("&#188;", "�");

pValue = pValue.Replace("&#189;", "�");

pValue = pValue.Replace("&#190;", "�");

pValue = pValue.Replace("&#191;", "�");

pValue = pValue.Replace("&#192;", "�");

pValue = pValue.Replace("&#193;", "�");

pValue = pValue.Replace("&#194;", "�");

pValue = pValue.Replace("&#195;", "�");

pValue = pValue.Replace("&#196;", "�");

pValue = pValue.Replace("&#197;", "�");

pValue = pValue.Replace("&#198;", "�");

pValue = pValue.Replace("&#199;", "�");

pValue = pValue.Replace("&#200;", "�");

pValue = pValue.Replace("&#201;", "�");

pValue = pValue.Replace("&#202;", "�");

pValue = pValue.Replace("&#203;", "�");

pValue = pValue.Replace("&#204;", "�");

pValue = pValue.Replace("&#205;", "�");

pValue = pValue.Replace("&#206;", "�");

pValue = pValue.Replace("&#207;", "�");

pValue = pValue.Replace("&#208;", "�");

pValue = pValue.Replace("&#209;", "�");

pValue = pValue.Replace("&#210;", "�");

pValue = pValue.Replace("&#211;", "�");

pValue = pValue.Replace("&#212;", "�");

pValue = pValue.Replace("&#213;", "�");

pValue = pValue.Replace("&#214;", "�");

pValue = pValue.Replace("&#215;", "�");

pValue = pValue.Replace("&#216;", "�");

pValue = pValue.Replace("&#217;", "�");

pValue = pValue.Replace("&#218;", "�");

pValue = pValue.Replace("&#219;", "�");

pValue = pValue.Replace("&#220;", "�");

pValue = pValue.Replace("&#221;", "�");

pValue = pValue.Replace("&#222;", "�");

pValue = pValue.Replace("&#223;", "�");

pValue = pValue.Replace("&#224;", "�");

pValue = pValue.Replace("&#225;", "�");

pValue = pValue.Replace("&#226;", "�");

pValue = pValue.Replace("&#227;", "�");

pValue = pValue.Replace("&#228;", "�");

pValue = pValue.Replace("&#229;", "�");

pValue = pValue.Replace("&#230;", "�");

pValue = pValue.Replace("&#231;", "�");

pValue = pValue.Replace("&#232;", "�");

pValue = pValue.Replace("&#233;", "�");

pValue = pValue.Replace("&#234;", "�");

pValue = pValue.Replace("&#235;", "�");

pValue = pValue.Replace("&#236;", "�");

pValue = pValue.Replace("&#237;", "�");

pValue = pValue.Replace("&#238;", "�");

pValue = pValue.Replace("&#239;", "�");

pValue = pValue.Replace("&#240;", "�");

pValue = pValue.Replace("&#241;", "�");

pValue = pValue.Replace("&#242;", "�");

pValue = pValue.Replace("&#243;", "�");

pValue = pValue.Replace("&#244;", "�");

pValue = pValue.Replace("&#245;", "�");

pValue = pValue.Replace("&#246;", "�");

pValue = pValue.Replace("&#247;", "�");

pValue = pValue.Replace("&#248;", "�");

pValue = pValue.Replace("&#249;", "�");

pValue = pValue.Replace("&#250;", "�");

pValue = pValue.Replace("&#251;", "�");

pValue = pValue.Replace("&#252;", "�");

pValue = pValue.Replace("&#253;", "�");

pValue = pValue.Replace("&#254;", "�");

pValue = pValue.Replace("&#255;", "�");

pValue = pValue.Replace("&amp;", "&");

pValue = pValue.Replace("&quot;", "\"");

pValue = pValue.Replace("&lt;", "<");

pValue = pValue.Replace("&gt;", ">");

pValue = pValue.Replace("&Agrave;", "�");

pValue = pValue.Replace("&Aacute;", "�");

pValue = pValue.Replace("&Acirc;", "�");

pValue = pValue.Replace("&Atilde;", "�");

pValue = pValue.Replace("&Auml;", "�");

pValue = pValue.Replace("&Aring;", "�");

pValue = pValue.Replace("&AElig;", "�");

pValue = pValue.Replace("&Ccedil;", "�");

pValue = pValue.Replace("&Egrave;", "�");

pValue = pValue.Replace("&Eacute;", "�");

pValue = pValue.Replace("&Ecirc;", "�");

pValue = pValue.Replace("&Euml;", "�");

pValue = pValue.Replace("&Igrave;", "�");

pValue = pValue.Replace("&Iacute;", "�");

pValue = pValue.Replace("&Icirc;", "�");

pValue = pValue.Replace("&Iuml;", "�");

pValue = pValue.Replace("&ETH;", "�");

pValue = pValue.Replace("&Ntilde;", "�");

pValue = pValue.Replace("&Otilde;", "�");

pValue = pValue.Replace("&Ouml;", "�");

pValue = pValue.Replace("&Ouml;", "�");

pValue = pValue.Replace("&Oslash;", "�");

pValue = pValue.Replace("&copy;", "�");

pValue = pValue.Replace("&reg;", "�");

pValue = pValue.Replace(" ", " ");



return pValue;



}


Second

I updated the line 582 in method called ReflectUpdatedFormValues

From

AjaxCallHelper.WriteSetFieldScript(clientID, text);

To

AjaxCallHelper.WriteSetFieldScript(clientID,ConvertAsciiToText(text)); 

Third

Compile the project Magic Ajax for .net 2.0.

Conclusion

This update solves the problem for developer�s that work with Special Character like Latin American.

For download source code of the Magic Ajax access the site http://www.magicajax.net.

Update the UI\Controls\AjaxPanel.cs by new UI\Controls\AjaxPanel.cs in source code from Magic Ajax project.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here