Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Telerik
Build great .NET business apps
Net Web
Cross-Platform
Desktop
Reporting and Documents
Testing & Mocking
Debugging
Build JavaScript UI
Javascript
AI for Developers & IT
Ensure AI program success
AI Coding
Additional Tools
Enhance the developer and designer experience
UI/UX Tools
Free Tools
CMS
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.