Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Wednesday, March 21, 2012

Urgent - Trying to make Localization work (RC version)

I am going crazy with localization. It doesn't work :(

I have 2 projects: a web application (ajax enabled) and a class library with a server control.

I have this in my server control:

[assembly:

WebResource("SomeControl.myScript.js","text/javascript")]

[assembly:

ScriptResource("SomeControl.myScript.js","SomeControl.Res","SomeControl.Res")]

The myScript.js file is marked as embedded resource.

I have SomeControl.res and SomeControl.pt-BR.res resource files.

I have EnableScriptLocalization="true" in my ScriptManager.

I am registering myScript.js in the OnInit phase of the server control, like this:

// get script manager

ScriptManager scrMgr =ScriptManager.GetCurrent(this.Page);// register javascript fileScriptReference scriptRef =newScriptReference(

Page.ClientScript.GetWebResourceUrl(

this.GetType(),"SomeControl.myScript.js"));

scriptRef.NotifyScriptLoaded =

true;

scriptRef.ScriptMode =

ScriptMode.Auto;

scrMgr.Scripts.Add(scriptRef);

--

The problem is that the client side resource object is not being generated!!!

When I run the page and look with Fiddler, I have only the contents of myScript.js,but not the contents of the resources that I need.

I should have the contents of the resource files ready to be used client side.

I really need this feature and I am speding hours with this without success... I'd like to know if anyone here could make it work, and if possible, give me a help.

Thanks!

I found the problem :)

I must register myScript.js like this:

// get script manager

ScriptManager scrMgr =ScriptManager.GetCurrent(this.Page);// register javascript fileScriptReference scriptRef =newScriptReference("SomeControl.myScript.js","SomeControl");

scriptRef.ResourceUICultures =

newstring[] {"pt-BR" };

scriptRef.NotifyScriptLoaded =

true;

scriptRef.ScriptMode =

ScriptMode.Auto;

scrMgr.Scripts.Add(scriptRef);

Now it works...

Cheers!

Use Ajax in Control

Hello,

I am creating a class library where I have a custom web control.

This control has Labels and a GridView.

I want to use an UpdatePanel but there is a problem:

VS 2005 is not recognizing the Update Panel that I created. How should I do this?

Should I just create my web control and then place it inside an Update Panel on my page?

Thanks,

Miguel

How are you adding the UpdatePanel? Is this a user control? What do you mean when you say that VS 2005 is not "recognizing" the UpdatePanel that you created; what errors are you getting, ie, what happens?

Use Class instead of Web Service?

Hello,

Can I use a class instead of a web service? If I communicated with only my page I would like to speed up the process by not using a web service.

TIA,

Clank

Clank

Take a look at this quickstart
http://atlas.asp.net/quickstart/atlas/doc/services/default.aspx#webpage

thanks
-jhawk