PageView = null

2 posts, 0 answers
  1. John
    John avatar
    8 posts
    Member since:
    Apr 2008

    Posted 16 Jul 2008 Link to this post

    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.

  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 17 Jul 2008 Link to this post

    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.

    1 <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
    2  
    3 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    4  
    5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    6  
    7 <html xmlns="http://www.w3.org/1999/xhtml"
    8 <head runat="server"
    9     <title>Untitled Page</title> 
    10 </head> 
    11 <body> 
    12     <form id="form1" runat="server"
    13         <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
    14         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    15             <script type="text/javascript"
    16                 function TabSelected(sender, eventArgs) { 
    17                     var tab = eventArgs.get_tab(); 
    18                     var pageViewID = tab.get_pageViewID(); 
    19                     if(pageViewID == '<%= RadPageView2.ClientID %>') { 
    20                         var window = $find('<%= RadWindow1.ClientID %>'); 
    21                         window.show(); 
    22                     } 
    23                 } 
    24              
    25                 function CallBackFunction(sender, text) { 
    26                     if(text) { 
    27                         var textBox = $find('<%= RadTextBox1.ClientID %>'); 
    28                         textBox.set_value(text); 
    29                         var multiPage = $find('<%= RadMultiPage1.ClientID %>'); 
    30                         var pageView = multiPage.findPageViewByID('RadPageView1'); 
    31                         pageView.show(); 
    32                     } 
    33                 } 
    34             </script> 
    35         </telerik:RadCodeBlock> 
    36  
    37         <telerik:RadTabStrip ID="RadTabStrip1" runat="server" 
    38             MultiPageID="RadMultiPage1"  
    39             OnClientTabSelected="TabSelected"
    40             <Tabs> 
    41                 <telerik:RadTab PageViewID="RadPageView1" Text="One" /> 
    42                 <telerik:RadTab PageViewID="RadPageView2" Text="Two" /> 
    43             </Tabs> 
    44         </telerik:RadTabStrip> 
    45  
    46         <telerik:RadMultiPage ID="RadMultiPage1" runat="server"
    47             <telerik:RadPageView ID="RadPageView1" runat="server"
    48                 <telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
    49             </telerik:RadPageView> 
    50             <telerik:RadPageView ID="RadPageView2" runat="server"
    51                  
    52             </telerik:RadPageView> 
    53         </telerik:RadMultiPage> 
    54          
    55         <telerik:RadWindow ID="RadWindow1" runat="server" 
    56             Modal="true" 
    57             NavigateUrl="Window.aspx" 
    58             ClientCallBackFunction="CallBackFunction"
    59         </telerik:RadWindow> 
    60     </form> 
    61 </body> 
    62 </html> 
    63  

    1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Window.aspx.cs" Inherits="Window" %> 
    2  
    3 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    4  
    5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    6  
    7 <html xmlns="http://www.w3.org/1999/xhtml"
    8 <head runat="server"
    9     <title>Untitled Page</title> 
    10 </head> 
    11 <body> 
    12     <form id="form1" runat="server"
    13         <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
    14         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    15             <script type="text/javascript"
    16                 function GetRadWindow() { 
    17                     var oWindow = null
    18                     if (window.radWindow) 
    19                         oWindow = window.radWindow; 
    20                     else if (window.frameElement.radWindow) 
    21                         oWindow = window.frameElement.radWindow; 
    22                     return oWindow; 
    23                 }  
    24                  
    25                 function Button1_Click() { 
    26                     var window = GetRadWindow(); 
    27                     var textBox = $find('<%= RadTextBox1.ClientID %>'); 
    28                     var text = textBox.get_value(); 
    29                     window.Close(text); 
    30                 } 
    31             </script> 
    32         </telerik:RadCodeBlock> 
    33          
    34         <telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
    35         <asp:Button ID="Button1" runat="server" Text="Close" OnClientClick="Button1_Click(); return false;" /> 
    36     </form> 
    37 </body> 
    38 </html> 
    39  

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

    Sincerely,
    Kevin Babcock
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top