Call / Embed Method in ASPX

  • Thread starter Thread starter Andrew Robinson
  • Start date 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:
 
If this isn't happening during a databound operation, you typically set it
in codebehind.

HyperLink98.NavigateUrl = GetUrl();


Karl
 
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

Back
Top