RadWindow set position and scroll into view?

3 posts, 0 answers
  1. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 24 Feb 2014 Link to this post

    I have a page that is longer (vertically) than the browser window, and will probably always be that way. The bottom of the form has a contact us section where you can enter your email address, a message and click a button to send an email to the site administrator. I want to display a modal dialog message in a RadWindow informing them that the message was sent. But I want to retain the parent window's scroll position. This means that I need to position the window over the section of the page that is visible, and prevent the main page from resetting to the top of the form. Is there any examples of doing something like this?

    Thanks, Steve
  2. Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 26 Feb 2014 Link to this post

    Hello Steve,

    I am not sure I understand the entire concept, but here are some pointers on what I can gather:

    - if you need only to notify the user that the mail was sent (either from JavaScript, or from server code), you can simply use RadNotification: http://demos.telerik.com/aspnet-ajax/notification/examples/servershowwithnewtext/defaultcs.aspx. Note how you can show it with a new message from the server without actually updating it as a part of the partial postback

    - if you need to have a RadWindow show up (and preserve the scroll position), collect data and notify the user on success I suggest the following:

       = examine this article on the ways to open a RadWindow: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html. Note how they are all JavaScript based, so attaching a client-side handler to a button/other element can let you show the popup without posting the page, i.e., without losing the scroll position. Note that anchors with href=# will scroll the page to the top.

       = if the data collection form is simple, you can use the ContentTemplate of the dialog, because it will still be a part of the main page and you can use the notification to notify the user if you like.The difference between the two modes is explained here: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx.

       = you may also find useful this article on using AJAX with RadWindow: http://www.telerik.com/help/aspnet-ajax/radwindow-ajaxifying.html.

    Let me know if you have further questions on the matter after examining these resources.

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. DevCraft R3 2016 release webinar banner
  4. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 26 Feb 2014 in reply to Marin Bratanov Link to this post

    Thanks Marin,

    I will review the information you provided. As it turns out I just figured out that the link button that invoked the process that displayed the message was not properly ajaxified. I did not notice I was getting a full page refresh when displaying the message. Once I got it ajaxified, it showed up nicely, centered on the viewport, without causing the page to scroll to the top.

    As far as RadNotification, it's a bit more complex, but in a nutshell, the site is highly stylized and I have all my messages, dialogs and forms using a custom style, and I want to use the full capability of RadWindow to display all of my messages.

    Thanks, Steve
Back to Top