Hey,
My problem is that I'm trying to create a RadTileList programmatically to populate an Intranet staff page.
We've developed a page in which users can choose an image of themselves, along with fill out the details we don't keep in Active Directory, and then we pull the photo, AD information and profile information and pop it into a staff page. Works beautifully, and the Telerik controls really improve the look and feel of it.
Then we wanted to make a series of image galleries for different teams, different job roles etc. We can pull the data for these groups no problem. Then the plan is that everyone gets their image put into a gallery, which we're going to use the RadToolTip functionality on to preview before they can open the page to learn all about the member of staff. Herein lies my problem, because I can't populate the RadTileList using the byte array (byte[]) images.
Below is an example of how I'm TRYING to code it. Unfortunately I have so much to do on this project and so little time to do it in that I really can't afford to be spending much longer trying to get this to work. Any chance you could provide a solution?
protected void LoadStaffList(DataTable staffList, Image notAvailable)
{
var tileList = new RadTileList();
var tileGroup = new TileGroup();
var memoryStream = new MemoryStream();
var image = Resources.photonotavailable;
image.Save(memoryStream, ImageFormat.Png);
foreach (DataRow row in staffList.Rows)
{
var imageTile = new RadImageTile();
var userPhoto = row["UserPhoto"] != DBNull.Value ? row["UserPhoto"] : null;
imageTile.DataItem = (byte[]) userPhoto ?? memoryStream.ToArray(); <-- YOU CAN'T DO THIS!!
imageTile.Shape = TileShape.Square;
tileGroup.Tiles.Add(imageTile);
}
tileList.Groups.Add(tileGroup);
divTeamInformation.Controls.Add(tileList);
}
I'm assuming there's a way to use a RadBinaryImage or something else in place of the RadImageTile? Or some other way to set the data without writing the byte array to a temp file and then setting the temp file as the Image Source, because both of those would be incredibly annoying to have to do.
Any help you could provide would be massively appreciated. Apologies if it's a duplicate topic but I couldn't see one like it.
Thanks,
-Alexis