By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,015 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

passing parameters to hyperlink control

P: n/a
I have this line of code in my .aspx page

<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue" Runat="server"
NavigateUrl='<%# "View.aspx?id=" + ID.ToString()%>'>View
Customer</asp:HyperLink>

But when the page runs it shows text only "View Customer" without hyperlink.
This is what it was rendered in the page source <a id="hrefView"
class="main" style="color:Blue;">View Customer</a>

Not working either when removed the ID
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue" Runat="server"
NavigateUrl='<%# "View.aspx?id=100"%>'>View Customer</asp:HyperLink>

Don't pass parameters to the control, then it renders correctly
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue" Runat="server"
NavigateUrl='View.aspx'>View Customer</asp:HyperLink>

Does anybody have any ideas what I'm doing wrong here. Any help is
appreciated.

Lan
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi why not perform this operation from the code-behind?

Or:

Change the following:
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue" Runat="server"
NavigateUrl='View.aspx?id=<%# ID.ToString()%>'>View Customer</asp:HyperLink>

Yama

"Lan H. Nguyen" <la**@wizardones.com> wrote in message
news:e9**************@TK2MSFTNGP12.phx.gbl...
I have this line of code in my .aspx page

<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
Runat="server"
NavigateUrl='<%# "View.aspx?id=" + ID.ToString()%>'>View
Customer</asp:HyperLink>

But when the page runs it shows text only "View Customer" without
hyperlink.
This is what it was rendered in the page source <a id="hrefView"
class="main" style="color:Blue;">View Customer</a>

Not working either when removed the ID
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
Runat="server"
NavigateUrl='<%# "View.aspx?id=100"%>'>View Customer</asp:HyperLink>

Don't pass parameters to the control, then it renders correctly
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
Runat="server"
NavigateUrl='View.aspx'>View Customer</asp:HyperLink>

Does anybody have any ideas what I'm doing wrong here. Any help is
appreciated.

Lan

Nov 18 '05 #2

P: n/a
Thanks for the response.
Yes I can surely do this from the code behind, it's just that I am curious
of what is possibly wrong to my code.

Your other solution shows the link alright but give this on the url
View.aspx?id=<%# ID.ToString()%>

"Yama" <yk*****@stbernard.com> wrote in message
news:OD****************@TK2MSFTNGP14.phx.gbl...
Hi why not perform this operation from the code-behind?

Or:

Change the following:
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue" Runat="server" NavigateUrl='View.aspx?id=<%# ID.ToString()%>'>View Customer</asp:HyperLink>
Yama

"Lan H. Nguyen" <la**@wizardones.com> wrote in message
news:e9**************@TK2MSFTNGP12.phx.gbl...
I have this line of code in my .aspx page

<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
Runat="server"
NavigateUrl='<%# "View.aspx?id=" + ID.ToString()%>'>View
Customer</asp:HyperLink>

But when the page runs it shows text only "View Customer" without
hyperlink.
This is what it was rendered in the page source <a id="hrefView"
class="main" style="color:Blue;">View Customer</a>

Not working either when removed the ID
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
Runat="server"
NavigateUrl='<%# "View.aspx?id=100"%>'>View Customer</asp:HyperLink>

Don't pass parameters to the control, then it renders correctly
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
Runat="server"
NavigateUrl='View.aspx'>View Customer</asp:HyperLink>

Does anybody have any ideas what I'm doing wrong here. Any help is
appreciated.

Lan


Nov 18 '05 #3

P: n/a
Try <%= ID.ToString()%>

"Lan H. Nguyen" <la**@wizardones.com> wrote in message
news:O7*************@TK2MSFTNGP10.phx.gbl...
Thanks for the response.
Yes I can surely do this from the code behind, it's just that I am curious
of what is possibly wrong to my code.

Your other solution shows the link alright but give this on the url
View.aspx?id=<%# ID.ToString()%>

"Yama" <yk*****@stbernard.com> wrote in message
news:OD****************@TK2MSFTNGP14.phx.gbl...
Hi why not perform this operation from the code-behind?

Or:

Change the following:
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"

Runat="server"
NavigateUrl='View.aspx?id=<%# ID.ToString()%>'>View

Customer</asp:HyperLink>

Yama

"Lan H. Nguyen" <la**@wizardones.com> wrote in message
news:e9**************@TK2MSFTNGP12.phx.gbl...
>I have this line of code in my .aspx page
>
> <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
> Runat="server"
> NavigateUrl='<%# "View.aspx?id=" + ID.ToString()%>'>View
> Customer</asp:HyperLink>
>
> But when the page runs it shows text only "View Customer" without
> hyperlink.
> This is what it was rendered in the page source <a id="hrefView"
> class="main" style="color:Blue;">View Customer</a>
>
> Not working either when removed the ID
> <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
> Runat="server"
> NavigateUrl='<%# "View.aspx?id=100"%>'>View Customer</asp:HyperLink>
>
> Don't pass parameters to the control, then it renders correctly
> <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
> Runat="server"
> NavigateUrl='View.aspx'>View Customer</asp:HyperLink>
>
> Does anybody have any ideas what I'm doing wrong here. Any help is
> appreciated.
>
> Lan
>
>



Nov 18 '05 #4

P: n/a
Or try this:
<%# Convert.ToString(DataBinder.Eval(Container.DataIte m, "ID")) %>
"Lan H. Nguyen" <la**@wizardones.com> wrote in message
news:O7*************@TK2MSFTNGP10.phx.gbl...
Thanks for the response.
Yes I can surely do this from the code behind, it's just that I am curious
of what is possibly wrong to my code.

Your other solution shows the link alright but give this on the url
View.aspx?id=<%# ID.ToString()%>

"Yama" <yk*****@stbernard.com> wrote in message
news:OD****************@TK2MSFTNGP14.phx.gbl...
Hi why not perform this operation from the code-behind?

Or:

Change the following:
<asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"

Runat="server"
NavigateUrl='View.aspx?id=<%# ID.ToString()%>'>View

Customer</asp:HyperLink>

Yama

"Lan H. Nguyen" <la**@wizardones.com> wrote in message
news:e9**************@TK2MSFTNGP12.phx.gbl...
>I have this line of code in my .aspx page
>
> <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
> Runat="server"
> NavigateUrl='<%# "View.aspx?id=" + ID.ToString()%>'>View
> Customer</asp:HyperLink>
>
> But when the page runs it shows text only "View Customer" without
> hyperlink.
> This is what it was rendered in the page source <a id="hrefView"
> class="main" style="color:Blue;">View Customer</a>
>
> Not working either when removed the ID
> <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
> Runat="server"
> NavigateUrl='<%# "View.aspx?id=100"%>'>View Customer</asp:HyperLink>
>
> Don't pass parameters to the control, then it renders correctly
> <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue"
> Runat="server"
> NavigateUrl='View.aspx'>View Customer</asp:HyperLink>
>
> Does anybody have any ideas what I'm doing wrong here. Any help is
> appreciated.
>
> Lan
>
>



Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.