Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do you use public application method in markup

Posted on 2010-09-05
4
Medium Priority
?
628 Views
Last Modified: 2013-11-07
I have an application class method defined as follows:

Public Class AppHelper

    Public Shared Function MyFunction(ByVal sInput As String)
        Return "MyFunction." & sInput
    End Function

End Class

Open in new window


In my markup I want to do something like this:
    <div>
        <%# AppHelper.MyFunction(DataBinder.Eval(Container.DataItem, "MyField"))  %>
    </div>

Open in new window


But building the application says AppHelper is not defined. If I change the call to just MyFunction(...), it says MyFunction is not defined. I can get around this by moving the function to the base page class but is there any way to call it directly from the AppHelper class?

Thanks in advance.
0
Comment
Question by:ZekeLA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:richard_hughes
ID: 33607412
Hello ZekeLA

Try this:

Thanks,

Richard Hughes
<div> 
        <% AppHelper.MyFunction(DataBinder.Eval(Container.DataItem, "MyField"))  %> 
    </div>

Open in new window

0
 
LVL 1

Author Comment

by:ZekeLA
ID: 33607595
Removing the # symbol didn't work. It still gives the same problem. Also, this function is actually inside another function which I think requires the # symbol. When I removed the symbol, that part of the markup didn't display.
0
 
LVL 9

Assisted Solution

by:richard_hughes
richard_hughes earned 1000 total points
ID: 33607601
Hmm, i'm not sure of any other way using markup. You could try wrapping the call to AppHelper in a method in your page class, or perhaps in your page's base class. Then call that method in your markup. That would work.
Thanks
0
 
LVL 1

Accepted Solution

by:
ZekeLA earned 0 total points
ID: 33607649
That's what I've currently got it place. I have the method defined in a class and I then call that from a method with the same name in my page's base class. I was just wondering if there was a way not to have to create the proxy method.

I want to wait a day or two to see if anyone else has a way to bypass the proxy method before I close this out.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Screencast - Getting to Know the Pipeline

610 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