I want display binaryimage in radlistview with xml datasouce.
Each listview item height is 300px.
If Image data's height is greater than width (portrait ) then I want image height set to 300px.
If Image data's width is greater than height (landscape) then I want image width set to 300px.
so I want every image set to 300 x 300 square box.
I set to binaryimage set to width = 300px, height = 300px then all Image set by 300 by 300 size with distortion ratio!
I want portrait, landscape image to display square box without distort it's raito.
So I coded below but It does'nt work.
Each listview item height is 300px.
If Image data's height is greater than width (portrait ) then I want image height set to 300px.
If Image data's width is greater than height (landscape) then I want image width set to 300px.
so I want every image set to 300 x 300 square box.
I set to binaryimage set to width = 300px, height = 300px then all Image set by 300 by 300 size with distortion ratio!
I want portrait, landscape image to display square box without distort it's raito.
So I coded below but It does'nt work.
protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e)
{
RadListViewDataItem li = (RadListViewDataItem)e.Item;
RadBinaryImage PhotoImage = (RadBinaryImage)e.Item.FindControl("RadBinaryImage1");
if (PhotoImage.Width.Value > PhotoImage.Height.Value)
{
PhotoImage.Width = 300;
}
else
{
PhotoImage.Height = 300;
}
}