Click here to Skip to main content
16,016,535 members
Articles / Web Development / ASP.NET
Article

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

Rate me:
Please Sign up or sign in to vote.
2.41/5 (7 votes)
2 Jun 2006 59.9K   16   10
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:

C#
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 <st1:metricconverter w:st="on" productid="582 in">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


Written By
Web Developer
Brazil Brazil
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalquestion Pin
dave.dolan7-May-07 10:48
dave.dolan7-May-07 10:48 
GeneralRe: question Pin
leandro Ikezili8-May-07 8:26
leandro Ikezili8-May-07 8:26 
GeneralRe: question Pin
dave.dolan8-May-07 9:30
dave.dolan8-May-07 9:30 
QuestionSolution For Special Character in TextBox Multiline in Magic Ajax For .net 2.0 Pin
valdivino26-Feb-07 8:58
valdivino26-Feb-07 8:58 
GeneralSolution Pin
Member 188259523-Jan-07 23:52
Member 188259523-Jan-07 23:52 
GeneralRe: Solution Pin
leandro Ikezili27-Feb-07 1:56
leandro Ikezili27-Feb-07 1:56 
GeneralCode improvement Pin
José Carlos Chaves de Melo Junior12-Jun-06 15:47
José Carlos Chaves de Melo Junior12-Jun-06 15:47 
GeneralRe: Code improvement Pin
leandro Ikezili14-Jun-06 7:36
leandro Ikezili14-Jun-06 7:36 
QuestionImprovement Pin
Xaroth2-Jun-06 13:19
Xaroth2-Jun-06 13:19 
Might be better to make a regex that fetches the character ascii codes from the - ÿ range, since == (char)32;.. would mean a bit more code but will probably run a tad smoother
QuestionRe: Improvement Pin
stixoffire24-Jun-08 23:18
stixoffire24-Jun-08 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.