Elastic Capabilities for built in radalert

4 posts, 0 answers
  1. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 12 Aug Link to this post

    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

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 12 Aug Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 12 Aug in reply to Marin Bratanov Link to this post

    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

  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 15 Aug Link to this post

    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.
Back to Top