This is a migrated thread and some comments may be shown as answers.

Elastic Capabilities for built in radalert

3 Answers 102 Views
Window
This is a migrated thread and some comments may be shown as answers.
Vasssek
Top achievements
Rank 1
Vasssek asked on 12 Aug 2016, 08:29 AM

Hello,

I would like to ask you, how to use em or % unity instead of px when calling radalert from client side. I follow code script from documentation:

http://docs.telerik.com/devtools/aspnet-ajax/controls/window/alert,-confirm,-prompt-dialogs/radalert-dialog

Parameters width and height accept only values in px. But what If I want to change radalert window width based on different screen resolutions ?

My example is in the attachment. The radalert has width 420px. When user changes screen resolution to small, it means @media only screen and (min-width: 361px) and (max-width: 768px). Font has been changed but radalert window width remained the same (I want to decrease its width based on resolution).

Please help me to solve this issue.

Thank you.

Best regards

Vasssek

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 12 Aug 2016, 08:38 AM

Hi Vasssek,

The following KB explains how you can set a RadWindow's size in percent: http://www.telerik.com/support/kb/aspnet-ajax/window/details/setting-size-in-percent-for-the-radwindow. The radalert() method returns a reference to the RadWindow it creates so you can store and use it.

You may also find interesting RadNotification for showing messages to your users, because it supports percent units out of the box: http://demos.telerik.com/aspnet-ajax/notification/examples/sizeinpercent/defaultcs.aspx.

Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Vasssek
Top achievements
Rank 1
answered on 12 Aug 2016, 02:46 PM

Hello Marin,

your suggested solution works for me :) I have another question in connection to window percenatge size. I use on my page RadPageLayout control. The question is how can I get on client side which type of viewport breakpoints is currently in use ? If I will know this, than I can set appropriate percentage for each of breakpoints (xs, sm, etc...).

http://docs.telerik.com/devtools/aspnet-ajax/controls/pagelayout/creating-responsive-design/viewport-breakpoints

Or do I have to just work with browser Width value ?

Thank you

Regards

Vasssek

0
Marin Bratanov
Telerik team
answered on 15 Aug 2016, 08:36 AM

Hi Vasssek,

RadPageLayout uses CSS @media queries and there is no built-in way to get the currently active one via JS. Also, this means there is no direct integration between the RadPageLayout CSS and the RadWIndow JavaScript-based size.

What you can look into is the window.matchMedia method. You can find more details about it in the net, e.g. here. Considering that, it is likely that just getting the viewport dimensions will be easier, but I cannot presume to make this decision instead of you.

Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Window
Asked by
Vasssek
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Vasssek
Top achievements
Rank 1
Share this question
or