populate control in ascx

P

Peter

Hi

I have an ascx file, which has a "hyperlink", eg:

<asp:HyperLink ID="myLink" Text="LINK" runat="server" NavigateUrl="" />

Is it possible to set the navigate-url dynamically in the ascx, or is
it only possible in the code-behind?

Eg. can I do something like:
<asp:HyperLink ID="myLink" Text="LINK" runat="server" NavigateUrl="<%=
urlString %>" />

(Where urlString is a string declared earlier on the ascx).

Thanks,
Peter
--
 
G

Gustavo Arriola

Hi!

You need to create a publicly owned in order to associate the UserControl
from Codebehind

Best regards,

______________
Gustavo Arriola
 
P

Peter

You need to create a publicly owned in order to associate the
UserControl from Codebehind

Sorry, I don't really understand what you wrote. I want to set the
value of the NavigateUrl property on the asp:HyperLink control.

How can I do this in the ascx?

In the code behind I can do
myLink.NavigateUrl = "http://www.whatever";
for example. But I want to set the value in the ascx.

Thanks,
Peter
 
G

Gustavo Arriola

Sorry, I don't really understand what you wrote.
I'm sorry, I'm no speak in english jeje

value of the NavigateUrl property on the asp:HyperLink control.

Do you need create a public property in your usercontrol to associate (this
property) to server control.
For example:

In your ASCX
public String URL
{
set {
myLink.NavigateUrl = value;
}
}


In your ASPX

UserControlName1.URL = "http://www.whatever";

Best regards,

Gustavo Arriola
 

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,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top