current height in c#

4 posts, 0 answers
  1. John
    John avatar
    44 posts
    Member since:
    Apr 2011

    Posted 11 Sep 2013 Link to this post

    I need to get the current height of a RadWindow in codebehind.  The "Height" property seems to be always the original height of the window, not the current height.

    Failing that, I need some function on the client that fires after every postback on the client.
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 16 Sep 2013 Link to this post

    Hello John,

    The height of the RadWindow is always the original one, because the control is reopened after a postback and its configuration is reset. You could utilize the custom settings of the Persistence Framework to store the state of the window thus keeping it height after a postback.

    If you want to execute a JavaScript function after a postback, you can use the RegisterStartupScript method in order to register the desired function from the code-behind.

    Regards,
    Slav
    Telerik
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    44 posts
    Member since:
    Apr 2011

    Posted 16 Sep 2013 Link to this post

    The actual size of the radwindow sticks during a postback as in the window does not resize back to the original size, the Height property, however, is the original size.  I see this is a bit of a problem.
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 18 Sep 2013 Link to this post

    Hi John,

    The Width and Height properties of the RadWindow control are server properties that define its default size. If the control is disposed on the client and shown after a postback it will have these dimensions, regardless of the previous size it had in the browser (e.g. after the user had it resized) In your case the postbacks are most likely partial and the RadWindow is not disposed.

    The entire rendering and user interaction with the control are done on the client, even its popup element is created with JavaScript (which greatly reduces its footprint on the server and in the HTTP response) and the price for that is the fact that you cannot access its current state on the server. The server cannot know what happens in the browser.

    In the same manner you cannot know how large the browser viewport is on the server without adding some custom code that will store this information (e.g. in a hidden field) in order to pass it to the server.

    So, what I an suggest is using the OnClientResizeEnd event of the control and its getWindowBounds() client-side method to get and store the current dimensions in order to use them on the server.


    Regards,
    Marin Bratanov
    Telerik
    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 RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top