Link to home
Start Free TrialLog in
Avatar of jackjohnson44
jackjohnson44

asked on

asp.net 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") %>
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

You're very close.

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

Open in new window


Or:
<!-- 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

Avatar of jackjohnson44
jackjohnson44

ASKER

Thanks, I can implement the first example, but when I try the second, the control doesn't load.
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.
ASKER CERTIFIED SOLUTION
Avatar of Sammy
Sammy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial