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(";", ";");
pValue = pValue.Replace("<", "<");
pValue = pValue.Replace("=", "=");
pValue = pValue.Replace(">", ">");
pValue = pValue.Replace("?", "?");
pValue = pValue.Replace("@", "@");
pValue = pValue.Replace("A", "A");
pValue = pValue.Replace("B", "B");
pValue = pValue.Replace("C", "C");
pValue = pValue.Replace("D", "D");
pValue = pValue.Replace("E", "E");
pValue = pValue.Replace("F", "F");
pValue = pValue.Replace("G", "G");
pValue = pValue.Replace("H", "H");
pValue = pValue.Replace("I", "I");
pValue = pValue.Replace("J", "J");
pValue = pValue.Replace("K", "K");
pValue = pValue.Replace("L", "L");
pValue = pValue.Replace("M", "M");
pValue = pValue.Replace("N", "N");
pValue = pValue.Replace("O", "O");
pValue = pValue.Replace("P", "P");
pValue = pValue.Replace("Q", "Q");
pValue = pValue.Replace("R", "R");
pValue = pValue.Replace("S", "S");
pValue = pValue.Replace("T", "T");
pValue = pValue.Replace("U", "U");
pValue = pValue.Replace("V", "V");
pValue = pValue.Replace("W", "W");
pValue = pValue.Replace("X", "X");
pValue = pValue.Replace("Y", "Y");
pValue = pValue.Replace("Z", "Z");
pValue = pValue.Replace("[", "[");
pValue = pValue.Replace("\", @"\");
pValue = pValue.Replace("]", "]");
pValue = pValue.Replace("^", "^");
pValue = pValue.Replace("_", "_");
pValue = pValue.Replace("`", "`");
pValue = pValue.Replace("a", "a");
pValue = pValue.Replace("b", "b");
pValue = pValue.Replace("c", "c");
pValue = pValue.Replace("d", "d");
pValue = pValue.Replace("e", "e");
pValue = pValue.Replace("f", "f");
pValue = pValue.Replace("g", "g");
pValue = pValue.Replace("h", "h");
pValue = pValue.Replace("i", "i");
pValue = pValue.Replace("j", "j");
pValue = pValue.Replace("k", "k");
pValue = pValue.Replace("l", "l");
pValue = pValue.Replace("m", "m");
pValue = pValue.Replace("n", "n");
pValue = pValue.Replace("o", "o");
pValue = pValue.Replace("p", "p");
pValue = pValue.Replace("q", "q");
pValue = pValue.Replace("r", "r");
pValue = pValue.Replace("s", "s");
pValue = pValue.Replace("t", "t");
pValue = pValue.Replace("u", "u");
pValue = pValue.Replace("v", "v");
pValue = pValue.Replace("w", "w");
pValue = pValue.Replace("x", "x");
pValue = pValue.Replace("y", "y");
pValue = pValue.Replace("z", "z");
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("‹", "‹");
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("œ", "œ");
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("­", "­");
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("¾", "¾");
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("Ï", "Ï");
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("à", "à");
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("ñ", "ñ");
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("<", "<");
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("Ï", "Ï");
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(" ", " ");
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.