call code inline

I have a dll and function call that I can call in my code behind.  How do I do it inline?  In this example, it just returns a string.

This is how I can do it in the code behind now.  I can set the result string to a lable
using MyDom.Utilities.Classes;
string result = ResourceController.ReadResourceValue("file", "key");

I want to be able to do this inline like:
<%= ResourceController.ReadResourceValue("file", "key") %>
Who is Participating?
SammyConnect With a Mentor Commented:
in your aspx on the top type <%@ Import Namespace="Fmg.Cti.UI.Utilities.Classes.ResourceController" %> or whatever the namespace your classes are in

Todd GerbertIT ConsultantCommented:
You're very close.

<%= MyDom.Utilities.Classes.ResourceController.ReadResourceValue("file", "key") %>

Open in new window

<!-- Top of Page Here -->
<%@ Imports Namespace="MyDom.Utilities.Classes" %>
<!-- The @Imports directive is equivelant to a "using" statement in code-behind, and must appear at top of file -->
<%= ResourceController.ReadResourceValue("file", "key") %>

Open in new window

jackjohnson44Author Commented:
Thanks, I can implement the first example, but when I try the second, the control doesn't load.
Todd GerbertIT ConsultantCommented:
I made a typo, it's Import, not Imports.
jackjohnson44Author Commented:
Thanks, I am having issues and I am not sure what is wrong.  I had this working using the full name, then tried the other and now nothing will work.

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?)

Again, I believe that I had this working.  I am not sure why this is happening.

Thanks again for your help.
All Courses

From novice to tech pro — start learning today.