Call / Embed Method in ASPX

  • Thread starter Andrew Robinson
  • Start date
A

Andrew Robinson

quick question:

I need to call a method from within my ASPX file. What is the syntax? What I
have isn't working.

<asp:HyperLink ID="HyperLink98" runat="server" NavigateUrl='<%= GetUrl()
%>'>Back to Summary1</asp:HyperLink>

in my cs file:
protected string GetUrl()
{

return "This is a test";

}





thanks:
 
K

Karl Seguin [MVP]

If this isn't happening during a databound operation, you typically set it
in codebehind.

HyperLink98.NavigateUrl = GetUrl();


Karl
 
W

Walter Wang [MSFT]

Hi Andrew,

Thanks for your posting.

The <%= construct can only be used in client script for write some value
from server. The hyperlink control is run at server side.

You can use the <%# construct if it's happening during a databound
operation.

Regards,

Walter Wang
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top