Click here to Skip to main content
12,957,526 members (60,110 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi guys,

My question I hope is an easy one to answer...

I have two hidden fields which I want to build a URL with their values. I have this so far but it does not work.

<asp:Image ID="Image" runat="server" ImageUrl="~/ShowImage.ashx?id='<%=hdID.Value%>'&name='<%=hdName.Value%>'" Width= "300" ImageAlign="Left"/>

Could anyone please give me a hand?


Posted 19-Jan-12 21:57pm
incaunu 20-Jan-12 7:06am
it won't work ... you cannot put the values of the hidden fields from html code, only in your cs files.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can not do like this in .aspx page
The alternative is you can write the following code in ur .aspx.cs page.

In Page Load Event write the code to get the value from hiddenfield and assign it to the imageurl property if the image or in the javascript also

sample code to do in pageload event
protected void Page_Load(object sender, EventArgs e)
      Image.ImageUrl = hdID.Value;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try this
<asp:image id="Image" runat="server" imageurl="~/ShowImage.ashx?id='<%=hdID.Value%>'&name='<%#hdName.Value%>'" width="300" imagealign="Left"></asp:image>
Caz1224 20-Jan-12 9:13am
Nope, not quite. Tracing the code in ShowImage.ashx is displays

id = "'<%=hdID.Value%>'"
name = "'<%"
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

I did all of the data binding in code rather than trying to make the HTML do the evals

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,994
CHill60 3,550
Maciej Los 3,312
ppolymorphe 2,170
Jochen Arndt 1,973

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100