Solved

asp.net call code inline

Posted on 2011-09-21
5
444 Views
Last Modified: 2012-05-12
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") %>
0
Comment
Question by:jackjohnson44
  • 2
  • 2
5 Comments
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 36575771
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

0
 

Author Comment

by:jackjohnson44
ID: 36575927
Thanks, I can implement the first example, but when I try the second, the control doesn't load.
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 36575944
I made a typo, it's Import, not Imports.

http://msdn.microsoft.com/en-us/library/eb44kack.aspx
0
 

Author Comment

by:jackjohnson44
ID: 36576673
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.
0
 
LVL 27

Accepted Solution

by:
Sammy earned 500 total points
ID: 36578365
in your aspx on the top type <%@ Import Namespace="Fmg.Cti.UI.Utilities.Classes.ResourceController" %> or whatever the namespace your classes are in

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now