Hi,

I want to display Chinese character in text box in Ajax Update Panel. But now i am getting error message as below.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)

Timestamp: Sat, 5 Jun 2010 13:12:18 UTC

Message: Sys.WebForms.PageRequestManagerParserErrorExceptio n: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near '

|120|hiddenField|__VIEWSTA'.

Line: 4723

Char: 21

Code: 0

URI: http://localhost:49299/AjaxUpdatePan...ffffffec2d9970

----------------------------------------------------------------------------------

But I tried with without ajax update panel. it's working perfectly.

Can any one help me.

Default.aspx code:-

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Ajax UpdatePanel</title></head><body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /> </ContentTemplate> </asp:UpdatePanel> </div> </form></body></html>
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Ajax UpdatePanel</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label ID="Label1" runat="server" Text=""></asp:Label>

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Button" />

</ContentTemplate>

</asp:UpdatePanel>

</div>

</form>

</body>

</html>

Default.aspx.vb code:-

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = Resources.Resource.EmailMessage
'TextBox1.Text = EncodeString(Resources.Resource.EmailMessage, "GB2312")
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Charset = "GB2312"
'ScriptManager1.RegisterPostBackControl(Button1)
Label1.Text = Resources.Resource.EmailMessage
End Sub
Function EncodeString(ByVal SourceData As String, ByVal CharSet As String) As String
Dim bSourceData As Byte() = Encoding.Default.GetBytes(SourceData)
Dim OutEncoding As System.Text.Encoding = System.Text.Encoding.GetEncoding(CharSet)
Dim output As String = OutEncoding.GetString(bSourceData)
Return output
End Function
End Class
Resource Key content:- (This is encoding with windows-1252 format)

EmailMessage=µç×ÓÓʼþѶϢ

Web.config

<globalization responseEncoding="windows-1252" requestEncoding="windows-1252" culture="zh-CN" uiCulture="zh-CN"/>

Source code available at
AjaxUpdatePanel_POC.zip - Windows Live

Thanks

Sakthivel