Last post Sep 19, 2007 04:50 AM by CJRyun
Apr 24, 2007 11:50 AM|CJRyun|LINK
I am newbie in using the Mobile Web Forms. I have placed <mobile:Image> in the ItemTemplate of a <mobile:ObjectList> ; now what i want to do is display images in this Image control from a collection object which holds the image URLs in string format.
I have tried using the OnItemDataBind event of the Object List where I can bind the src Image URL to the image control.But when i try to find the control and set the ImageURL using the code below ::
System.Web.UI.MobileControls.Image Img = new System.Web.UI.MobileControls.Image();
Img.ImageUrl = ImageCollection[i].ToString(); // here ImageCollection is an ArrayList
it returns null;
How do I set the source to the Image control dynamically using the collection [ Arraylist]
I would appreciate if someone can send me some source code or samples on how to do this .
Thanks in Advance.
Apr 26, 2007 12:05 PM|bobbyz|LINK
Not exactly what you have but when using Mobile:Link control in the item template of the ObjectList control, I do the following:
In Page_Load event, I set the ObjectList to my datasource (an arrayList) and do the databinding.
In PreRender event of the ObjectList
link = item.FindControl(
link.NavigateUrl = "Set to whatever you want"
This seems to work fine for me.
I just wish all this was clearly explained somewhere. Every article you read only does micky mouse stuff.
Apr 27, 2007 12:09 PM|CJRyun|LINK
Thanks for the idea.The pre-render works good.
U r very right there is very little info available on these concepts on the net.
I am pasting the C# code below; lets see if it does good to someone else too.:)
C# Code :
foreach (ObjectListItem item
i += 1;
System.Web.UI.MobileControls.Image img = (System.Web.UI.MobileControls.Image)item.FindControl("Image1");
if (img !=
img.ImageUrl = ImageList[i].ToString();
Apr 30, 2007 12:22 PM|bobbyz|LINK
Aug 08, 2007 11:53 PM|inesense|LINK
Sep 19, 2007 04:50 AM|CJRyun|LINK
... below is the code for the page_load ...
ImageList is the Obejct List
ImageCollection = DA.GetImages();
u might have already got this done ... but if u didnt this is for you !