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

setting position for Radwindow from serverside

6 Answers 237 Views
Window
This is a migrated thread and some comments may be shown as answers.
Arima
Top achievements
Rank 1
Arima asked on 06 Sep 2011, 09:50 PM
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?

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Sep 2011, 05:03 AM
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.
0
Arima
Top achievements
Rank 1
answered on 07 Sep 2011, 12:48 PM
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);
   }
0
Marin Bratanov
Telerik team
answered on 08 Sep 2011, 04:12 PM
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 >>

0
Arima
Top achievements
Rank 1
answered on 08 Sep 2011, 07:25 PM
Hi Marin

Thanks for your guide.
0
Arima
Top achievements
Rank 1
answered on 09 Sep 2011, 08:14 AM
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
0
Marin Bratanov
Telerik team
answered on 13 Sep 2011, 09:45 AM
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.
Tags
Window
Asked by
Arima
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arima
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or