don't know if this is the right category, but I think the question is pretty simple.
I've got a web user control wich contains an image tag. When the control loads, I want to set the ImageUrl property to something like this:
"~/WUC/ShowLogo.aspx?id=" + PartnerID + @dotnet.itags.org."&sz=" + Size
This page just takes the id and the given size and outputs a thumbnail from an image in the database.
Now the image doesn't show up. When I check the source of the rendered html page I see this:
<img id="ctl00_cph_pcMain_imgLogo" src="http://pics.10026.com/?src=WUC/ShowLogo.aspx?id=1&sz=75" style="border-width:0px;"/
pretty obvious where everything goes wrong.. It encodes the & tot & wich is not really a valid url..
My question: How do I stop the component, or prolly the page the component is on, from encoding the url?
Not sure what goes worng, it shouldn't encode it by default behaviour.
imgLogo.ImageURL = "/WUC/ShowLogo.aspx?id=" + PartnerID + "&sz=" + Size;
should work fine.
Can you show us the piece of code where you set the imageURL property ?
you're right, it shouldn't encode, I have no freaking idea why it won't..
code behind:
protected void Page_Load(object sender, EventArgs e)
{
imgLogo.ImageUrl = "~/WUC/ShowLogo.aspx?id=" + PartnerID + "&sz=" + Size;
lblTitle.Text = Title;
lnkInfo.NavigateUrl = @."~/Info.aspx?id=" + PartnerID;
}
page:
<table>
<tr>
<td><asp:Image runat="server" ID="imgLogo" /></td>
<td>
<asp:Label runat="server" ID="lblTitle" />
<br />
<asp:HyperLink runat="server" ID="lnkInfo">meer <asp:Image runat="server" ID="imgArrow" ImageUrl="~/media/images/doublearrow.gif" /></asp:HyperLink>
</td>
</tr>
</table
anyone got a clue?
No comments:
Post a Comment