Wednesday, March 28, 2012

AJAX update panel

Dear ALL;

I have a problem in the updatepanel.

I put a scriptmanager the an updatepanel.in the updatepanel i put a timer control and a label.

all what i need is to update the label with current time.

the code i write is

protectedvoid Page_Load(object sender,EventArgs e)

{

if (!Page.IsPostBack)

{

DateLabel.Text =DateTime.Now.ToString();

}

}

protectedvoid DateTimer_Tick(object sender,EventArgs e)

{

DateLabel.Text =DateTime.Now.ToString();

}

but it gives me a javascript error

Line: 184

char:1

code:0

Error: 'Sys' is undefined

when i view the source of the page i found the source of the error is this statement

Sys.Application.initialize();

What is theSYS?

Thanks in advance...

Make sure you have the following config section in your web.config

<

httpHandlers>
<removeverb="*"path="*.asmx"/>
<addverb="*"path="*.asmx"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<addverb="*"path="*_AppService.axd"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<addverb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"validate="false"/>
</httpHandlers>

No comments:

Post a Comment