Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.NET
<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?

Regards,

Caz
Posted
Comments
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.

 
Share this answer
 
v2
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
C#
protected void Page_Load(object sender, EventArgs e)
{
      Image.ImageUrl = hdID.Value;
}
 
Share this answer
 
v3
Try this
ASP.NET
<asp:image id="Image" runat="server" imageurl="~/ShowImage.ashx?id='<%=hdID.Value%>'&name='<%#hdName.Value%>'" width="300" imagealign="Left"></asp:image>
 
Share this answer
 
v3
Comments
Caz1224 20-Jan-12 9:13am    
Nope, not quite. Tracing the code in ShowImage.ashx is displays

id = "'<%=hdID.Value%>'"
name = "'<%"
I did all of the data binding in code rather than trying to make the HTML do the evals
 
Share this answer
 

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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900