Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mobile:image

Status
Not open for further replies.

martman700

IS-IT--Management
Apr 1, 2005
28
0
0

I may be crazy, but it doesn't seem as though it's possbile to have a variable in a <mobile:image> tag now does it. I've search for hmm about 10 hours online for an example, but doesn't seem to want work.

A normal tag is like:
<mobile:image runat="server" ImageURL="mypic.gif"></mobile:image>

But I want to use a file name retreived from a table in SQL server. Something like:

<mobile:image runat="server" ImageURL="<%# picturename%>"></mobile:image>

I've tried to use a label and it produces the correct string...like:

<mobile:image runat="server" ImageURL="mypic.gif"></mobile:image>

But this simply outputs to the mobile devices and doesn't render it, like it would in an HTML browser.

And on top of this, it doesn't seem like you can run a function inside of a Mobile form so that I could produce the correct mobile:image string.

I was thinking I could do:

<mobile:Form runat="server" id="Form1">
<%# getPicture(somevariable_name) %>
</mobile:Form>

The error message I get with is that is doesn't ever find 'somevariable_name'.

Any thoughts/suggestions?


 
Why not give it an id and then assign it a ImageURL via that?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks for the response. An ID? Like what?

I've tried below already and that didn't seem to do anything beneficial.

<mobile:image ID="MyImage" ImageURL="<%# mypic %>" runat="server"/>

Maybe not understand how the ID can even benefit here.
 
martman

assign the value in your code behind class, not on the aspx page


i.e. your page load event

MyImage.ImageURL = mypic();

 
Wow tperri, you are a genius!

Thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top