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
--
You need to create a publicly owned in order to associate the UserControl
from Codebehind
Best regards,
______________
Gustavo Arriola
"Peter" <xdz...@hotmail.com> escribió en el mensaje
news:ufdSgX7H...@TK2MSFTNGP02.phx.gbl...
> > 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).
> 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
>> I want to set the
> 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