Dalvir Saini
Dalvir Saini

Reputation: 390

How to make call of C# function on aspx page.`

I have a function written in a class in C#. This function returns the path for src attribute of img tag. Now I want to use this in on page this way:

<img src=<%=myclass.GetImageUrl('imagename')%> >

Is it posible to do so in ASP.NET on aspx pages?

Or is there any other waw to call function on a aspx page?

Upvotes: 3

Views: 11144

Answers (1)

SLaks
SLaks

Reputation: 888185

Your code will work fine, as long is the class is public and the function is public static, and as long as you've imported the namespace in an <%@ Import %> directive.

Upvotes: 5

Related Questions