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

PageView = null

1 Answer 101 Views
Window
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 16 Jul 2008, 06:12 PM
I am pretty much frustraited with the new telerik Ajax controls. For 3 days (including today) i have been just following the online examples and none of them work because of the issue below.

I have the following scenario:
in an asp.net content page (VS 2008 .net 2.0) i have 1 RadMUltipage with 2 page views. Within one of the views I open a radwindow as a dialog, do some work and close the dialog. In attempt to pull information from the closing dialog i ran into the following problem:

According to documentation i can call this line in a client side function:

var

multiPage = $find("<%=RadMultiPage1.ClientID %>")

which returns the reference to the multipage. i always get null.  here is the aspx code for the multipage:

<

telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0"  MultiPageID="RadMultiPage1">
<telerik:RadPageView ID="rgpvCustomers" runat="server">
<div>
<table.....


I am calling this line of code in this javascript function:

function

CallBackFunction(radWindow, returnValue)

{

if (returnValue.CustAddrInfo)

{

var multiPage = $find("<%=RadMultiPage1.ClientID %>");

var pageView = multiPage.findPageViewByID("rgpvProjects");

.......

}

}

i added the MultiPageID as part of my trouble shooting. I bascially call a radwindow in modal mode, once work is done and i close the window this method gets called via the RadWindowManager. Not being able to pull information from the Closing window and use that in the pageveiw is making this impossible to use. The callbackfunction is being called as i added a line of code that shows me an alert message in that function.

Other things i have noticed is when opening the "Configure Ajax Manager" for the RadAjaxManager i dont see any controls to configure. This did work within a user control i was using to test before but this control is not part of this page.

1 Answer, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 17 Jul 2008, 03:34 PM
Hello John,

I'm not entirely sure I understand what you are trying to do, but I wrote up a quick demo to show you how to get some of this functionality working. Basically I have written a page with a RadTabStrip control which has two RadTab controls, each connecting to their own RadPageView control. Upon opening one of the tabs, a RadWindow pops up with a RadTextBox and close button. Upon closing the RadWindow, the CallBackFunction receives the arguments passed from the RadWindow and displays them in a different RadTab control. What you should note is that I am able to find and reference the RadMultiPage control in the RadWindow's CallBackFunction.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
            <script type="text/javascript"
                function TabSelected(sender, eventArgs) { 
                    var tab = eventArgs.get_tab(); 
                    var pageViewID = tab.get_pageViewID(); 
                    if(pageViewID == '<%= RadPageView2.ClientID %>') { 
                        var window = $find('<%= RadWindow1.ClientID %>'); 
                        window.show(); 
                    } 
                } 
             
                function CallBackFunction(sender, text) { 
                    if(text) { 
                        var textBox = $find('<%= RadTextBox1.ClientID %>'); 
                        textBox.set_value(text); 
                        var multiPage = $find('<%= RadMultiPage1.ClientID %>'); 
                        var pageView = multiPage.findPageViewByID('RadPageView1'); 
                        pageView.show(); 
                    } 
                } 
            </script> 
        </telerik:RadCodeBlock> 
 
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" 
            MultiPageID="RadMultiPage1"  
            OnClientTabSelected="TabSelected"
            <Tabs> 
                <telerik:RadTab PageViewID="RadPageView1" Text="One" /> 
                <telerik:RadTab PageViewID="RadPageView2" Text="Two" /> 
            </Tabs> 
        </telerik:RadTabStrip> 
 
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server"
            <telerik:RadPageView ID="RadPageView1" runat="server"
                <telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
            </telerik:RadPageView> 
            <telerik:RadPageView ID="RadPageView2" runat="server"
                 
            </telerik:RadPageView> 
        </telerik:RadMultiPage> 
         
        <telerik:RadWindow ID="RadWindow1" runat="server" 
            Modal="true" 
            NavigateUrl="Window.aspx" 
            ClientCallBackFunction="CallBackFunction"
        </telerik:RadWindow> 
    </form> 
</body> 
</html> 
 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Window.aspx.cs" Inherits="Window" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
            <script type="text/javascript"
                function GetRadWindow() { 
                    var oWindow = null
                    if (window.radWindow) 
                        oWindow = window.radWindow; 
                    else if (window.frameElement.radWindow) 
                        oWindow = window.frameElement.radWindow; 
                    return oWindow; 
                }  
                 
                function Button1_Click() { 
                    var window = GetRadWindow(); 
                    var textBox = $find('<%= RadTextBox1.ClientID %>'); 
                    var text = textBox.get_value(); 
                    window.Close(text); 
                } 
            </script> 
        </telerik:RadCodeBlock> 
         
        <telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
        <asp:Button ID="Button1" runat="server" Text="Close" OnClientClick="Button1_Click(); return false;" /> 
    </form> 
</body> 
</html> 
 

I hope this was helpful. If I missed something or if you continue to have questions, please let me know.

Sincerely,
Kevin Babcock
Tags
Window
Asked by
John
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Share this question
or