开发者

asp.net calling code inline not working

In my code behind, I can do the following in the onload:

string x = Fmg.Cti.UI.Utilities.Classes.ResourceController.ReadResourceValue("Riblet", "Riblet_Chicklet1_Button_text");
开发者_运维技巧

This works without issue.

In my aspx page (I didn't remove the code from the onload), I put this:

<%= Fmg.Cti.UI.Utilities.Classes.ResourceController.ReadResourceValue("Riblet", "Riblet_Chicklet1_Button_text")%>

When I do, I got an error:

error CS0234: The type or namespace name 'Cti' does not exist in the namespace 'Fmg' (are you missing an assembly reference?)

I had this (or something quite similar) working. I don't know how I broke it.

Thanks again for your help.


You need to register the assemblies you're using in your page as well (just like usings in your code behind). See Do I have to add "<%@ Register assembly=" to every page?


Do you have that namespace imported? For asp.net you can do something like the following to make namespaces available for inline coding.

<%@ Import Namespace="Fmg.Cti.UI.Utilities.Classes" %>

You can make namespaces generally available to all of your asp.net pages for inline coding by adding the namespaces into the web.config

<system.web>
    <pages>
      <namespaces>
        ...
        <add namespace="Fmg.Cti.UI.Utilities.Classes" />
        ...
      </namespaces>
    </pages>
</system.web>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜