setting position for Radwindow from serverside

7 posts, 0 answers
  1. Arima
    Arima avatar
    25 posts
    Member since:
    Mar 2011

    Posted 06 Sep 2011 Link to this post

    Hi
    I have 2 tab control in my page. On load of the page,  i am opening a radwindow. Please see my code below.
    var oWnd;
    function pageLoad() {
        if (oWnd != null) {
            oWnd.close();
        }
        oWnd = radopen("GridDisplay.aspx", null);
        oWnd.setSize(200, 225);
        oWnd.moveTo(1090, 160);
        return false;
    }
    My requirement is, i have to set the window size and position based on the tab selection. For that i have done below code. I have created one hidden control.I assigned value for that. I was trying to take that value in client side, it was throwing error saying that cannot used content control <%# %>. I replaced with # to =. At that time it is not throwing error but it is not returning the value.
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                <script type="text/javascript">
                   var obj = document.getElementById("<%#hiddenCrewType.ClientID%>")
                   alert(obj);
                    alert(1);            
                </script>
        </telerik:RadScriptBlock>
    So now i decided to move my code to server side. Can you please suggest how to set the window size and position for the rad window in server side?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Sep 2011 Link to this post

    Hello Arima,

    You can use the serverside properties like Height, Width, Top and Left. You can find more information on this topic from the following documentations.
    Server-side Properties.
    Setting Server-Side Properties.

    Thanks,
    Shinu.
  3. Arima
    Arima avatar
    25 posts
    Member since:
    Mar 2011

    Posted 07 Sep 2011 Link to this post

    Hi Shinu

    I followed that link. Radwindow is not opening when i set VisibleOnPageLoad = false. If i made it to true, it is opening. Again the issue is, I have 2 tab in my page. First time, default selection of the tab, rad window is opeining. When i click on another tab, the rad window should popup with corresponding data. I have debugged my code. When i click on the another tab, opening the radwindow methos is getting called. But it is not refreshing the navigate url page.(i kept break point in pageload of my radwindow page)
    private void OpenRadWindow(string strCrewType)
       {
           RadWindowManager2.Windows.Clear();
           RadWindowManager2.EnableViewState = false;
           RadWindow radWindow = new RadWindow();
           radWindow.ID = "radWindow";
           radWindow.NavigateUrl = "GridDisplay.aspx";
           radWindow.VisibleOnPageLoad = true;
           radWindow.ReloadOnShow = true;
           radWindow.ShowContentDuringLoad = true;
           radWindow.Behaviors = WindowBehaviors.Move;
           radWindow.DestroyOnClose = true;
           radWindow.Height = 225;
           radWindow.Width = 200;
           radWindow.Top = 160;
           radWindow.Left = 1090;
             
           RadWindowManager2.Windows.Add(radWindow);
       }
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4630 posts

    Posted 08 Sep 2011 Link to this post

    Hi Arima,

    I am not sure I understand your scenario, yet I prepared for you two simple pages - one uses JavaScript to change the URL of the RadWindow when a different tab is selected, the other uses server-side code to inject a javascript function that will do the same (as shown in this sticky forum thread). Please examine them and see which is closer to your scenaio, then use it as basis for your further development. Instead of just changing the URL you can also change other settings of the RadWindows via the Client-side API. Note that I am using the RadTab's Value as the flag which determines the URL, but you can further extend this logic.


    Kind regards,
    Marin
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  5. Arima
    Arima avatar
    25 posts
    Member since:
    Mar 2011

    Posted 08 Sep 2011 Link to this post

    Hi Marin

    Thanks for your guide.
  6. Arima
    Arima avatar
    25 posts
    Member since:
    Mar 2011

    Posted 09 Sep 2011 Link to this post

    Marin,

    I have a clarification on opening the radwindow. The window is opening both the cases like client and server side. But both the ways we are using client side code. Without using the client side code, is it possible to do completely in server side. I have been tried. The window is opening only one time. When i click on the other tab, it is not relaunching.

    Regards
    Arima
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4630 posts

    Posted 13 Sep 2011 Link to this post

    Hi Arima,

    The RadWindow is entirely a client-side object, even its UI (i.e. the HTML) is created when it is shown. This means that it does not expose any server-side events and there is no server-side Show() method. Therefore it has to be manipulated via JavaScript and showing cannot be achieved via server-side code only. If you include the RadWindow in an update panel or you perform a full page postback you can set some of its properties server-side (Width, Height, Behaviors, NavigateUrl, etc), but you can do this also via JavaScript.

    In your case it seems like the tabstrip does not perform a full page postback and thus you cannot use the VisibleOnPageLoad property to make the RadWindow reopen each time the page is loaded, thus you need the JavaScript I sent in my previous reply.


    Regards,
    Marin
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top