Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

populate control in ascx

0 views
Skip to first unread message

Peter

unread,
Sep 26, 2008, 4:57:15 AM9/26/08
to
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
--

Gustavo Arriola

unread,
Sep 26, 2008, 5:59:49 AM9/26/08
to
Hi!

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...

Peter

unread,
Sep 26, 2008, 9:25:08 AM9/26/08
to
Gustavo Arriola wrote:

> > 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

Gustavo Arriola

unread,
Sep 27, 2008, 3:47:25 PM9/27/08
to
>> Sorry, I don't really understand what you wrote.
I'm sorry, I'm no speak in english jeje


>> 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


0 new messages