PDA

View Full Version : [CLOSED] question about the #{} notation in Handler



T3rryChan
May 02, 2012, 8:07 AM
Hi,

I have a MVC3 project using Razor ViewEngine. I am under the impression that #{Draw1} the a Handler like this



listeners.Click.Handler = "#{Draw1}.surface.getGroup('circles')


should turn into Javascript like this



App.Draw1.surface.getGroup('circles')


However, it is actually turn into the following js



Ext.get("Draw1").surface.getGroup('circles')


and surface is an undefined property. Thus, js throws an exception " Cannot call method 'getGroup' of undefined"

Daniil
May 02, 2012, 12:01 PM
Hi,

#{} searches a control with specified server ID and replace it with its ClientID.

But there are no controls in Razor, so, nothing to search.

But, fortunately, #{} is not required in Razor, because there is no any INamingContainer and you can use just

Namespace.componentID
to refer a component.

The default Namespace is "App".