Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
Support and Learning
Productivity and Design Tools
How to set the item width and height in accordance to the browser width and height in both code behind and client side?
Thanks.
Hi Alfred,
One option on the server-side is to use the DataBound event exposed by the RadListBox to set the desired item sizes:
protected void RadLightBox1_DataBound(object sender, EventArgs e) { foreach (RadLightBoxItem item in RadLightBox1.Items) { item.Height = 150; item.Width = 150; } }
<ClientEvents OnShowing="showing" />
JavaScript
function showing(sender, args) { var currentItemIndex = sender.get_currentItemIndex() var currentItem = sender.get_items().getItem(currentItemIndex) currentItem.set_width(150) currentItem.set_height(150) }
function showing(sender, args) { var currentItemIndex = sender.get_currentItemIndex() var currentItem = sender.get_items().getItem(currentItemIndex); currentItem.set_width(window.visualViewport.width - 100); currentItem.set_height(window.visualViewport.height - 100); }
Please let me know if any further questions come up.
Kind regards, Doncho Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.