Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
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?
 
Regards,
 
Caz
Posted 19-Jan-12 21:57pm
Caz1224292
Comments
incaunu at 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
good
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;
}
  Permalink  
v3
Rate this: bad
good
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>
  Permalink  
v3
Comments
Caz1224 at 20-Jan-12 9:13am
   
Nope, not quite. Tracing the code in ShowImage.ashx is displays
 
id = "'<%=hdID.Value%>'"
name = "'<%"
Rate this: bad
good
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
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
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