Refresh RadGrid On Close of RadWindow

28 posts, 0 answers
  1. Steve King
    Steve King avatar
    3 posts
    Member since:
    Jan 2008

    Posted 03 Dec 2008 Link to this post

    I have a RadGrid and when a use clicks on the Edit image a RadWindow opens with the record that they need to edit. After the user updates the information the use clicks the X in the top corner to close the window. I need to know how to set the RadGrid to then Refresh to show the updated data. I tried to use the OnClientClick and added the JavaScript:

    onDispose()
    {
    top.location.reload()
    }

    When I used this the page went into a loop on page load. I put this code on the parent page where I am using the RadWindowManager. Can anyone help me with a solution to this?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Dec 2008 Link to this post

    Hi Steve King,

    Add RadAjaxManager on page so that you can call the AjaxRequest from "OnClientClose" event of RadWindow. Then it is possible to rebind the RadGrid from server side, inside the "RadAjaxManager1_AjaxRequest" method. You can use following code snippet to achieve this.

    ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
            <Windows>  
                <telerik:RadWindow runat="server" OnClientClose="closeRadWindow" Behavior="Default" InitialBehavior="None"   
                    Left="" NavigateUrl="window.aspx" OpenerElementID="Button1"   
                    style="display:none;" Top="">  
                </telerik:RadWindow>  
            </Windows>  
    </telerik:RadWindowManager>  
     
      
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"   
            onajaxrequest="RadAjaxManager1_AjaxRequest">  
            <AjaxSettings>  
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls>  
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />  
                    </UpdatedControls>  
                </telerik:AjaxSetting>  
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                    <UpdatedControls>  
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />  
                    </UpdatedControls>  
                </telerik:AjaxSetting>  
            </AjaxSettings>  
        </telerik:RadAjaxManager>  
     
        </form>  
    </body>  
    </html>  
      
    <script type="text/javascript">  
    function closeRadWindow()  
    {  
        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();   
    }  
    </script>  

    C#:
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
    {  
            RadGrid1.MasterTableView.SortExpressions.Clear();  
            RadGrid1.MasterTableView.GroupByExpressions.Clear();  
            RadGrid1.Rebind();  


    Thanks,
    Princy.
  3. Steve King
    Steve King avatar
    3 posts
    Member since:
    Jan 2008

    Posted 04 Dec 2008 Link to this post

    Thanks so much for the fast reply on this. I tried to use your code but now I am getting a different JScript runtime error:

    'null' is null or not an object

    function
    onCloseRadWindow()

     

    {

        $find(

    "RadAjaxManager1").ajaxRequest()

     

     

    }

    I tried to change this to:

     

     

    function onCloseRadWindow()

     

    {

        document.getElementById(

    "RadAjaxManager1").ajaxRequest()

     

     

    }

    and i get a different error of: Object doesn't support this property or method

    All of this is happening on the Page Load instead of happening on the closing of the RadWindow.

  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Dec 2008 Link to this post

    Hi Steve King,

    I suggest you to modify the client side function as shown below, and check if it is working.

    JavaScript:
    <script type="text/javascript">    
    function closeRadWindow()    
    {    
        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest();     
    }    
    </script>   

    Regards,
    Princy.
  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 05 Dec 2008 Link to this post

    Hi Steve,

    As Princy has suggested, you should reference the RadAjaxmanager's client object by using the method $find. You are probably having a MasterPage, User Control or another INaming Container - if so, it will change the ID of the manager and the client id will be different - that is why you should use code blocks as Princy showed. The error you get when you use the getElementById function comes from the fact that when using it you reference an HTML element and not a client object - that is why the referenced element does not support the API, it is for the client object.

    I also recommend to examine the full source code of our online demo which demonstrates the discussed scenario. When you install RadControls, our online examples projects are automatically installed on your computer and you can not only examine their full source code, but also extend them further in order to meet your requirements.

    You can open the demos from here:

    Start\Programs\Telerik\RadControls for ASPNET AJAX\Open Sample WebSite In VisualStudio

    The actual location on your hard disk is the following one:

    C:\Program Files\Telerik\RadControls for ASPNET AJAX \Live Demos

    In case you need further assistance, please prepare a sample, fully runnable demo, open a new support ticket and send it to us along with detailed reproduction instructions and explanations.


    Greetings,

    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Alex
    Alex avatar
    1 posts
    Member since:
    Dec 2008

    Posted 11 Dec 2008 Link to this post

    Hi, We are using ASP.Net 3.5/VS 2008, which radcontrol version should we use? We downloaded two versions from telerik website,RadControls_Prometheus_2007_3_1425_dev.exe and RadControls_Q3_2007_SP2_dev.exe, we are confused that which one should we use? they both have some controls. In my case, I am using master page, and I registered javascript in mnasterpage.cs file protected void Page_Load(object sender, EventArgs e) {  
    //register Global JavaScript File  
    this.Page.ClientScript.RegisterClientScriptInclude("Global", ResolveUrl("~/CommonScripts/CommonScript.js"));   
    } then I have one common Javascript file which has all javascript functions,   
    function ShowEditForm(id, rowIndex)  
    {  
    // alert("Calling R21R33 window, ApplId : "+ id + " rowIndex is " + rowIndex );  
    var grid = document.getElementById("<%=RadGdR33.ClientID %>");   
    var grid = $find("<%=RadGdR33.ClientID %>");   
    var grid = window["<%= RadGdR33.ClientID %>"];  
    var rowControl = grid.MasterTableView.Rows[rowIndex].Control;  
    grid.MasterTableView.SelectRow(rowControl, true);  
    window.radopen("R21R33Request.aspx?ApplId=" + id, "R21R33RequestDlg");  
    return false;   
    }  
    however I am not able to run this function, it gives me error on the first line in ShowEditForm function, I tried var grid = document.getElementById("<%=RadGdR33.ClientID %>"); and var grid = $find("<%=RadGdR33.ClientID %>"); and var grid = window["<%= RadGdR33.ClientID %>"]; they all doesn't work. I did read some articles on telerik website, it seems like I need to pput this function in a script block, but where? could you please help me out? I really want to try this AJax thing, and I am a Telerik beginner user. Thanks,   
     
     
  7. Steve King
    Steve King avatar
    3 posts
    Member since:
    Jan 2008

    Posted 12 Dec 2008 Link to this post

    Thank you so much for your response. I followed the example in the Live Demo and I am no longer getting the errors but when the user clicks on the Update in the RadWindow I am still having problems getting it to close the RadWindow and Refresh the grid. Is there a way I can get the code for the update on this RadWindow? I have tried adding on the window manager OnClientClose but this does not seem to work.
  8. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 17 Dec 2008 Link to this post

    Hello Steve,

    I attached the code for this example to the thread. Let us know how this goes.

    Alex, if you are using ASP.NET AJAX, you should use the Prometheus suite - I also suggest to download a nd use a more recent version of the control - the latest one is Q3 2008. As for the problem that you experience, it will be best to open a support ticket and to send us a small sample project where we can reproduce the error. We will check it right away and get back to you with solution.


    Kind regards,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Abaid-ur-Rehman Zulfi
    Abaid-ur-Rehman Zulfi avatar
    3 posts
    Member since:
    Apr 2005

    Posted 03 Mar 2010 Link to this post

    Can anybody tell how to accomplish the same using Master/Detail scenario. I want to achieve the same with RadAjaxManagerProxy. Please provide sample code.
  10. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 08 Mar 2010 Link to this post

    Hi Abaid-ur-Rehman Zulfi,

    The logic in such scenario is absolutely the same - you only need to modify the ajaxRequest call as shown in this help article:
    http://www.telerik.com/help/aspnet-ajax/ajax-manager-proxy.html

    Kind regards,
    Georgi Tunev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  11. Abaid-ur-Rehman Zulfi
    Abaid-ur-Rehman Zulfi avatar
    3 posts
    Member since:
    Apr 2005

    Posted 09 Mar 2010 Link to this post

    Hi Georgi,
    Thanks for your reply. I have succeed to call manager_AjaxRequest function on RadWindow Closing, but the problem is RadGrid doesn't refresh itself. It seems, there is some AJAX problem!!
       protected void Page_Load(object sender, EventArgs e) 
            { 
                //RadAjaxManager manager = (RadAjaxManager)this.Master.FindControl("RadAjaxManager1"); 
                RadAjaxManager manager = RadAjaxManager.GetCurrent(Page); 
                //manager.ClientEvents.OnRequestStart = "onRequestStart"; 
                //manager.ClientEvents.OnResponseEnd = "onResponseEnd"; 
                manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest); 
            } 
     
            protected void manager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) 
            { 
                gridData.MasterTableView.SortExpressions.Clear(); 
                gridData.MasterTableView.GroupByExpressions.Clear(); 
                gridData.Rebind(); 
                             
            } 

    I am using following ajax settings in the page
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"
             <AjaxSettings> 
                 <telerik:AjaxSetting AjaxControlID="RadToolBar1"
                     <UpdatedControls> 
                         <telerik:AjaxUpdatedControl ControlID="lblStatus" /> 
                         <telerik:AjaxUpdatedControl ControlID="gridData"  
                             LoadingPanelID="RadAjaxLoadingPanel2" /> 
                     </UpdatedControls> 
                 </telerik:AjaxSetting> 
                 <telerik:AjaxSetting AjaxControlID="gridData"
                     <UpdatedControls> 
                         <telerik:AjaxUpdatedControl ControlID="gridData"  
                             LoadingPanelID="RadAjaxLoadingPanel2" /> 
                     </UpdatedControls> 
                 </telerik:AjaxSetting> 
                 <telerik:AjaxSetting AjaxControlID="RadAjaxManagerProxy1"
                     <UpdatedControls> 
                         <telerik:AjaxUpdatedControl ControlID="gridData"  
                             LoadingPanelID="RadAjaxLoadingPanel2" /> 
                     </UpdatedControls> 
                 </telerik:AjaxSetting> 
     
             </AjaxSettings> 
         </telerik:RadAjaxManagerProxy> 

  12. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 09 Mar 2010 Link to this post

    Hello,

    Can you try modifying the Page_Load event handler as below and see if the grid is properly refreshed now:

    protected void Page_Load(object sender, EventArgs e)  
    {  
        RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);  
        manager.AjaxSettings.AddAjaxSetting(manager, gridData);
        manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);  
    }


    Sincerely yours,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  13. Abaid-ur-Rehman Zulfi
    Abaid-ur-Rehman Zulfi avatar
    3 posts
    Member since:
    Apr 2005

    Posted 09 Mar 2010 Link to this post

    Dear Iana,

    Thanks a lot for your answer - this worked fine. The grid refreshes now properly.
  14. inanc
    inanc avatar
    17 posts
    Member since:
    Mar 2009

    Posted 01 Apr 2010 Link to this post

    Hi,
    I've been looking for the demo application given on the url:

    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid

    A snippet for that demo:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                <script type="text/javascript">
                function ShowEditForm(id, rowIndex)
                {
                    var grid = $find("<%= RadGrid1.ClientID %>");
                    
                    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                    grid.get_masterTableView().selectItem(rowControl, true);
                            
                    window.radopen("EditFormCS.aspx?EmployeeID=" + id, "UserListDialog");
                    return false;
                }
                function ShowInsertForm()
                {
                   window.radopen("EditFormCS.aspx", "UserListDialog");
                   return false;
                }
                function refreshGrid(arg)
                {
                 if(!arg)
                 {
                 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");            
                    }
                    else
                    {
                 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");            
                    }
                }

                function RowDblClick(sender, eventArgs)
                {
                 window.radopen("EditFormCS.aspx?EmployeeID=" + eventArgs.getDataKeyValue("EmployeeID"), "UserListDialog");
                }
                </script>
            </telerik:RadCodeBlock>


    And I could not understand what form element or event fires the function function refreshGrid(arg)
    I think, It should be called in  the onClientClose() of the radwindow.Does the given sample  code has some missed parts?

    I am trying to run that sample on Sitefinity. But I could not yet.
    Shortly the code that I use:

    <telerik:RadCodeBlock  ID="RadCodeBlock1" runat="server">
                <script type="text/javascript">
                    function ShowEditForm(id, rowIndex) {

                        window.radopen("UserControls/Pages/PaketKapsaminaAlma.aspx?IstId=" + id, "UserListDialog");
                        return false;
                    }
                    function ShowInsertForm() {

                        window.radopen("UserControls/Pages/PaketKapsaminaAlma.aspx", "UserListDialog");
                        return false;
                    }
                    function refreshGrid(arg) {
                        
                            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                    }
                    
                    function RowDblClick(sender, eventArgs) {
                        window.radopen("UserControls/Pages/Istek.PaketKapsaminaAlma?IstId=" + eventArgs.getDataKeyValue("ISTID"), "UserListDialog");
                    }
                </script>
            </telerik:RadCodeBlock>


    and I call the function refreshGrid(arg) on OnClientClose of RadWindow with ID UserListDialog

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="UserListDialog" runat="server" Title="Paket kapsamına alma" Height="300px"
                Width="300px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" OnClientClose="refreshGrid"
                Modal="true" />
        </Windows>
    </telerik:RadWindowManager>

    my AjaxRequest function on cs file is:

    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "Rebind")
            {
                BindMyGrid();//this is my function to bind the grid
               // rdgvIstektenAramaSonuclari.MasterTableView.SortExpressions.Clear();
                //rdgvIstektenAramaSonuclari.MasterTableView.GroupByExpressions.Clear();
                //rdgvIstektenAramaSonuclari.Rebind();
             }
        }  


    When  I used the recomended lines below  there were no action

                // rdgvIstektenAramaSonuclari.MasterTableView.SortExpressions.Clear();
                //rdgvIstektenAramaSonuclari.MasterTableView.GroupByExpressions.Clear();
                //rdgvIstektenAramaSonuclari.Rebind();

    It works great with my BindMyGrid() function which binds the grid with the related datasource of mine. But it works only once :( .

    When  I click the linkbutoton on the grid that opens radwindow no problem with it. And when I close the radwindow, it refreshs the grid perfectly..:) And I push the similar linkbutton on the grid to open the radwindow . And  no problem again. But when I update  the data belong  to grid and close the radwindow, it says that:

    Microsoft JScript runtime error: 'null' is null or not an object


    the problem is on the
     function refreshGrid(arg) {
                        
                            $find("ctl00_cntUst_ctl00_RadAjaxManager1").ajaxRequest();
                    }

     code can't find the object for the second onclientclose event of the radwindow.Any idea?
    Regards





  15. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 07 Apr 2010 Link to this post

    Hi inanc,

    To find where the refreshGrid() method is called, please review the aspx and cs files of the EditFormCS.aspx/EditFormVb.aspx page in the "Example Source Code & Description" section of the mentioned demo.

    Regarding the error you are facing: Could you please specify where is the RadAjaxManager defined and provide the ajax setting you have? Any additional information on your scenario and setup mmight help us get to the source of the problem.

    Regards,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  16. Chanan Zass
    Chanan Zass avatar
    63 posts
    Member since:
    Aug 2012

    Posted 12 Apr 2010 Link to this post

    Greetings,

    We are experiencing similar problems in the following scenario:
    - A RadGrid that is set within a RadTabStrip/RadMultiPage opens a window for editing items
    - Upon closing of window the RadGrid does not get refreshed and an error message ('null' is null or not an object) is thrown when encountering the line

    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); 

    that is part of the Javascript refreshGrid(arg) function.
    I should say that we have implemented this kind of RadGrids opening RadWindows in dozens of situations with no problem until now.
    The only difference here is that the Edit Window page includes a couple of RadComboBoxes (we have until now used only standard ASP.NET controls).

    Anyone has experienced this strange behavior?
    Thanks in advance.

  17. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 12 Apr 2010 Link to this post

    Hello Chanan,

    Could you please specify if the RadAjaxManager is declared in the place where the refreshGrid() javascript method is added?

    Greetings,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  18. Chanan Zass
    Chanan Zass avatar
    63 posts
    Member since:
    Aug 2012

    Posted 12 Apr 2010 Link to this post

    Thanks for responding.
    Here's the initial code in the main user control (ascx, within a RadTabStrip):
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  
     
         <script type="text/javascript">  
            function ShowEditForm(tyreId, rowIndex, carId) {  
                 var oWnd = window.radopen("EditTyre.aspx?tid=" + tyreId + "&cid=" + carId, "TyreEditDialog");  
                oWnd.setSize(600, 250);  
                oWnd.center();  
                return false;  
            }  
            function ShowInsertForm(carId) {  
                var oWnd = window.radopen("AddNewTyre.aspx?cid=" + carId, "TyreAddDialog");  
                oWnd.setSize(600, 250);  
                oWnd.center();  
                return false;  
     
            }  
            function refreshGrid(arg) {  
                if (!arg) {  
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");  
                }  
                else {  
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");  
                }  
            }  
        </script> 
    </telerik:RadScriptBlock>   
     
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"   
        Skin="Default">  
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"   
        DefaultLoadingPanelID="RadAjaxLoadingPanel1">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
         </AjaxSettings> 
    </telerik:RadAjaxManager> 

    Window Manager on that same page:

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
          Skin="Vista" ReloadOnShow="true">  
    </telerik:RadWindowManager> 

    Snippet from RadWindow page (.aspx)

    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  
        <script type="text/javascript">  
            function CloseAndRebind(args)  
            {  
                GetRadWindow().Close();  
                GetRadWindow().BrowserWindow.refreshGrid(args);  
            }  
              
            function GetRadWindow()  
            {  
                var oWindow = null;  
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)  
                      
                return oWindow;  
            }  
     
            function CancelEdit()  
            {  
                GetRadWindow().Close();       
            }  
            </script> 
         </telerik:RadScriptBlock> 

    Snippet from RadWindow code behind (VB):

    Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdate.Click  
            ' update record and close window  
            Dim mago As New MaGO  
            mago.AddNewTyre(RadComboBox1.SelectedValue, RadComboBox2.SelectedValue, txtDOT.Text, carId, warrantyId)  
            ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", True)  
     
        End Sub 

    As I've mentioned, similar code works on various sites we've created with no problem.
    Something I've just thought of: Is it possible that problems are created because the RadWindow page is being posted back at least once (to populate a second RadComboBox following a selection of a value in a first RadComboBox)?
    Would such post-back remove AJAX references of this window?

    Many thanks in advance.
  19. Umgul CETIN
    Umgul CETIN avatar
    1 posts
    Member since:
    Apr 2006

    Posted 14 Apr 2010 Link to this post

    Dear Lana,
    Thanks for your reply. I feel I am getting closerto the solution :)
    But it is impossible for me to run the your demo like code  successfuly yet. First of all, there are no clue about closing the radwindow when hitting the update button. I think it will be useful to show the contained in EditFormCS.aspx which is located on the demo page
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid
    .
    I am trying to use that components  in Sitefinity. So I do have a masterpage of course.I would like to give a cs and ascx file to review the problem.
    I have a RadAjaxManager with ID RadAjaxManager1on my masterpage.

    MasterPage
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"></telerik:RadAjaxManager> 
    ASCX
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="IstekAra.ascx.cs" Inherits="UserControls_Istek_IstekAra" %> 
    <table cellpadding="4" cellspacing="4"
        <tr> 
            <td valign="top" style="background-color:gainsboro"
                <asp:RadioButtonList ID="rdbtnIstekAra" runat="server"  
                    RepeatDirection="Horizontal" AutoPostBack="True"  
                    onselectedindexchanged="rdbtnIstekAra_SelectedIndexChanged"
                    <asp:ListItem Selected="True" Text="İstek numarasından ara" Value="0"></asp:ListItem> 
                    <asp:ListItem Text="İstekID den ara" Value="1"></asp:ListItem> 
                    <asp:ListItem Text="Cihaz özelliklerinden ara" Value="2"></asp:ListItem> 
                </asp:RadioButtonList> 
            </td> 
            <td> 
                <asp:Panel ID="pnlIstekNodanAra" runat="server"
                    <table> 
                        <tr style="background-color:gainsboro"
                            <td>Sadece bana ait olan cihazları getir</td> 
                            <td><asp:CheckBox ID="chkBanaAitCihazlar" runat="server" /></td
                        </tr> 
                        <tr> 
                            <td> 
                                Sadece belirli bir laboratuvar ile ilgileniyorsanız 
                            </td> 
                            <td> 
                                <asp:DropDownList ID="ddlLablar" runat="server"></asp:DropDownList> 
                            </td> 
                        </tr> 
                        <tr style="background-color:gainsboro"
                            <td> 
                                Yıl: 
                            </td> 
                            <td> 
                                <asp:TextBox ID="txtYil" runat="server" Width="46px" ></asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                İstek No: 
                            </td> 
                            <td> 
                                <asp:TextBox ID="txtIstekNo" runat="server" Width="46px"></asp:TextBox> 
                                <asp:RequiredFieldValidator ID="rqflvldIstekNo" ControlToValidate="txtIstekNo" ValidationGroup="IstekNo" Text="İstek numarası girilmelidir.." runat="server" ></asp:RequiredFieldValidator> 
                            </td> 
                        </tr> 
                        <tr style="background-color:gainsboro"
                            <td> 
                                Alt İstek No: 
                            </td> 
                            <td> 
                                <asp:TextBox ID="txtAltIstekNo" runat="server" Width="47px" ></asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr style="background-color:gainsboro"
                            <td> 
                                <asp:Button ID="btnIstektenAra" runat="server" CausesValidation="true"  
                                    OnClick="btnIstektenAra_Click" Text="Ara" ValidationGroup="IstekNo"  ToolTip="Sadece kalibrasyonları yapılmış, iptal edilmeyen istekleri getirir"/> 
                            </td> 
                            <td> 
                                &nbsp;</td> 
                        </tr> 
                    </table> 
                </asp:Panel> 
                <asp:Panel ID="pnlIstIddenAra" runat="server" Visible="false"
                    <table> 
                        <thead title="IstId'den arama"></thead> 
                        <tr> 
                            <td> 
                                IstId: 
                            </td> 
                            <td> 
                                <asp:TextBox ID="txtIstId" runat="server"></asp:TextBox> 
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtIstId" ValidationGroup="IstIddenArama" Text="Bir IstId değeri girilmelidir.." runat="server" ></asp:RequiredFieldValidator>                             
                            </td> 
                        </tr> 
                        <tr> 
                            <td colspan="2"
                                <asp:Button ID="btnIstIdAra" runat="server" OnClick="btnIstIdAra_Click" Text="Ara"  CausesValidation="true" ValidationGroup="IstIddenArama"/> 
                            </td> 
                        </tr> 
                    </table> 
                </asp:Panel> 
                <asp:Panel ID="pnlCihazOzelliklerindenAra" runat="server" Visible="false"
                <table> 
                    <tr> 
                        <td> 
                            Sertifika No: 
                        </td> 
                        <td> 
                            <asp:TextBox ID="txtCihazOzelliklerindenAraSertNo" runat="server"></asp:TextBox> 
                        </td> 
                    </tr> 
                     
                    <tr> 
                        <td> 
                            Cihaz adı:  
                        </td> 
                        <td> 
                            <asp:TextBox ID="txtCihazOzelliklerindenAraCihazAdi" runat="server"></asp:TextBox> 
                        </td> 
                    </tr> 
                     
                    <tr> 
                        <td> 
                            Marka:  
                        </td> 
                        <td> 
                            <asp:TextBox ID="txtCihazOzelliklerindenAraMarka" runat="server"></asp:TextBox> 
                        </td> 
                    </tr> 
                     
                    <tr> 
                        <td> 
                            Model:  
                        </td> 
                        <td> 
                            <asp:TextBox ID="txtCihazOzelliklerindenAraModel" runat="server"></asp:TextBox> 
                        </td> 
                    </tr> 
                     
                    <tr> 
                        <td> 
                            Seri no:  
                        </td> 
                        <td> 
                            <asp:TextBox ID="txtCihazOzelliklerindenAraSeriNo" runat="server"></asp:TextBox> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            Sorumlu:  
                        </td> 
                        <td> 
                            <asp:TextBox ID="txtCihazOzelliklerindenAraSorumlu" runat="server"></asp:TextBox> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td colspan="2"
                            <asp:Button ID="btnCihazOzelliklerindenAra" OnClick="btnCihazOzelliklerindenAra_Click" runat="server" Text="Ara" /> 
                        </td> 
                    </tr> 
                </table> 
                 
                </asp:Panel> 
            </td> 
        </tr> 
    </table> 
    <br /> 
    <telerik:RadGrid AutoGenerateColumns="False" ID="rdgvIstektenAramaSonuclari" Width="800"  
        CellPadding="0" CellSpacing="0" AllowFilteringByColumn="False" AllowSorting="True"  
        PageSize="10" ShowFooter="True" AllowPaging="False" runat="server" GridLines="None" 
        EnableLinqExpressions="False" OnItemCommand="rdgvFairmadanGelenIstekler_ItemCommand" 
        OnItemDataBound="rdgvFairmadanGelenIstekler_ItemDataBound"       
        OnSortCommand="rdgvFairmadanGelenIstekler_SortCommand"  
        OnItemCreated="rdgvIstektenAramaSonuclari_ItemCreated" 
        BorderStyle="None"
        <PagerStyle Mode="NextPrevAndNumeric" FirstPageText="İlk Sayfa" FirstPageToolTip="İlk Sayfa" 
            NextPagesToolTip="Sonraki sayfalar" NextPageToolTip="Sonraki sayfa" PageSizeLabelText="Sayfa boyutu:" /> 
        <GroupingSettings CaseSensitive="false" /> 
        <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="False" 
            ShowFooter="True" TableLayout="Auto" DataKeyNames="ISTID" NoMasterRecordsText="Gösterilebilecek kayıt bulunamadı...."
            <Columns> 
                <telerik:GridBoundColumn  DataField="ISTID" HeaderText="IstId" SortExpression="ISTID" UniqueName="ISTID" Visible="false"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn FilterControlWidth="20px" DataField="YIL" HeaderText="Yıl" 
                    SortExpression="YIL" UniqueName="YIL" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="false"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn FilterControlWidth="30px" DataField="ISTEKNO" HeaderText="İstekNo" 
                    SortExpression="ISTEKNO" UniqueName="ISTEKNO" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="false"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn FilterControlWidth="20px" DataField="ALTISTNO" HeaderText="AltİstekNo" 
                    SortExpression="ALTISTNO" UniqueName="ALTISTNO" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="false" Visible="true"
                </telerik:GridBoundColumn> 
                 
                <telerik:GridBoundColumn FilterControlWidth="20px" DataField="FIRMAADI" HeaderText="Firma Adı" 
                    SortExpression="FIRMAADI" UniqueName="FIRMAADI" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="true" Visible="true"
                </telerik:GridBoundColumn> 
                 
                <telerik:GridBoundColumn FilterControlWidth="25px" DataField="MUSTNO" HeaderText="Müşt.No" 
                    SortExpression="MUSTNO" UniqueName="MUSTNO" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="true"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn FilterControlWidth="50px" DataField="CIHAZADI" HeaderText="Cihaz Adı" 
                    SortExpression="CIHAZADI" UniqueName="CIHAZADI" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="true"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn FilterControlWidth="85px" DataField="IMALATCI" HeaderText="Marka" 
                    SortExpression="IMALATCI" UniqueName="IMALATCI" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="true" Visible="true"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn FilterControlWidth="35px" DataField="MODEL" HeaderText="Model" 
                    SortExpression="MODEL" UniqueName="MODEL" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" 
                    ShowFilterIcon="true"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="SERINO" HeaderText="Seri No" SortExpression="SERINO" 
                    UniqueName="SERINO"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="IPTAL" HeaderText="İptal" SortExpression="IPTAL" 
                    UniqueName="IPTAL" Visible="false"/> 
                            <telerik:GridTemplateColumn 
                                UniqueName="TemplateEditColumn"
                                <ItemTemplate> 
                                    <asp:HyperLink ID="EditLink" runat="server" Text="Düzenle"></asp:HyperLink> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
     
                 
            </Columns> 
        </MasterTableView> 
        <SortingSettings SortedAscToolTip="Artan sırada diz" SortedDescToolTip="Azalan sırada diz" 
            SortToolTip="Sıralamak için tıklayınız" /> 
        <StatusBarSettings LoadingText="Yüklüyor..." ReadyText="Hazır" /> 
    </telerik:RadGrid> 
     
     
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">   
    <script type="text/javascript"
        function onClose() { 
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("closed"); 
        } 
        function onOpen() { 
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("opened"); 
        } 
        function ShowEditForm(id, rowIndex) { 
     
            window.radopen("UserControls/Pages/Istek.aspx?IstId=" + id, "RadWindow1"); 
            return false; 
        } 
         
    </script>   
    </telerik:RadCodeBlock> 
     
    <telerik:RadWindow ID="RadWindow1" runat="server" OpenerElementID="<%# Button1.ClientID %>"     OnClientClose="onClose" OnClientShow="onOpen"/> 
      
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>   
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> 
     
     


    AND CS FILE
    using System; 
    using System.Data; 
    using System.Data.SqlClient; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using SubSonic; 
    using SubSonic.Query; 
    using KalData; 
    using Telerik.Web.UI; 
     
     
    public partial class UserControls_Istek_IstekAra : System.Web.UI.UserControl 
        int intBolgeKodu = 0
        protected void Page_Load(object sender, EventArgs e) 
        { 
            
            RadAjaxManager manager = RadAjaxManager.GetCurrent(this.Page); 
            manager.AjaxSettings.AddAjaxSetting(manager, rdgvIstektenAramaSonuclari); 
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest); 
            
          /*
            RadAjaxManager manager = RadAjaxManager.GetCurrent(this.Page); 
            manager.AjaxSettings.AddAjaxSetting(manager, Label1); 
            manager.AjaxSettings.AddAjaxSetting(this.rdgvIstektenAramaSonuclari, this.rdgvIstektenAramaSonuclari);
          */
            manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest); 
            if (!IsPostBack) 
            { 
                intBolgeKodu = DalClass.kal_BolgeKoduDon(Context.User.Identity.Name); 
                ddlLablariDoldur(); 
            } 
        } 
        protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) 
        { 
            switch (e.Argument) 
            { 
                case "closed": 
                    Label1.Text = "Closed"
                    //YilIstekAltIstekNoAramadanGridiBagla(); 
                    break; 
                case "opened": 
                    Label1.Text = "Opened"
                    break; 
            } 
        }  
     
     
        protected void ddlLablariDoldur() 
        { 
             
            string SQL = "select ID,KOD from lablar where BOLGEKODU=" + intBolgeKodu.ToString()+ " order by KOD"; 
            var pLablar = new CodingHorror(SQL).ExecuteReader(); 
            ddlLablar.DataSource = pLablar
            ddlLablar.DataTextField = "KOD"
            ddlLablar.DataValueField = "KOD"
            ddlLablar.DataBind(); 
            ddlLablar.Items.Insert(0, new ListItem("Lütfen laboratuvarı seçiniz", "0")); 
            ddlLablar.Enabled = true
        } 
        protected void btnIstektenAra_Click(object sender, EventArgs e) 
        { 
            YilIstekAltIstekNoAramadanGridiBagla(); 
        } 
         
        protected void YilIstekAltIstekNoAramadanGridiBagla() 
        { 
            int Yil = 0
            int AltIstekNo = 0
            string Kullanici = null
            string Lab = null
            intBolgeKodu = DalClass.kal_BolgeKoduDon(Context.User.Identity.Name); 
            if (txtYil.Text.Trim() != "") 
            { 
                Yil = int.Parse(txtYil.Text.Trim()); 
            } 
            int IstekNo = int.Parse(txtIstekNo.Text.Trim()); 
     
            if (txtAltIstekNo.Text.Trim() != "") 
            { 
                AltIstekNo = int.Parse(txtAltIstekNo.Text.Trim()); 
            } 
     
            int BolgeKodu = intBolgeKodu
            if (chkBanaAitCihazlar.Checked) 
            { 
                Kullanici = Context.User.Identity.Name; 
            } 
            if (ddlLablar.SelectedIndex != 0) 
            { 
                Lab = ddlLablar.SelectedValue; 
            } 
            DataSet ds = new DataSet(); 
            ds = DalClass.kal_YilIstekNoAltIstekNodanDon(Yil, IstekNo, AltIstekNo, BolgeKodu, Kullanici, Lab); 
            this.rdgvIstektenAramaSonuclari.DataSource = ds
            this.rdgvIstektenAramaSonuclari.DataBind(); 
            ds.Dispose(); 
        } 
        protected void rdgvFairmadanGelenIstekler_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
        { 
            if (e.CommandName == RadGrid.SelectCommandName && e.Item is GridDataItem) 
            { 
                GridDataItem dataItem = (GridDataItem)e.Item; 
                int key = int.Parse(dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["ISTID"].ToString()); 
                 
                RadWindow1.Width = 500
                RadWindow1.Height = 500
                RadWindow1.Modal = true
                RadWindow1.VisibleOnPageLoad = true
                RadWindow1.Skin = "Simple"
                RadWindow1.Title = "İstek Bilgisi"
                RadWindow1.NavigateUrl = "~/UserControls/Pages/Istek.aspx?IstId=" + key.ToString(); 
            } 
        } 
        protected void rdgvFairmadanGelenIstekler_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem) 
            { 
                GridDataItem dataItem = e.Item as GridDataItem; 
                //string iptalBilgisi=dataItem["IPTAL"].Text; 
                if (dataItem["IPTAL"].Text == "İptal") 
                { 
                    //dataItem.Cells[3].ForeColor = System.Drawing.Color.Red; 
                    dataItem.BackColor = System.Drawing.Color.Red; 
                    dataItem.ToolTip = "İptal edilmiş kayıt"
                } 
            } 
        } 
        protected void rdgvFairmadanGelenIstekler_SortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e) 
        { 
            if (rdbtnIstekAra.SelectedIndex == 2)//cihaz ozelliklerinden arama 
            { 
                btnCihazOzelliklerindenAra_Click(null, null); 
            } 
            if (rdbtnIstekAra.SelectedIndex == 0)//istek numarasından arama 
            { 
                btnIstektenAra_Click(null, null); 
            } 
        } 
        protected void btnIstIdAra_Click(object sender, EventArgs e) 
        { 
            int IstId=int.Parse(txtIstId.Text.Trim()); 
            DataSet ds = new DataSet(); 
            ds = DalClass.kal_IstIddenIstekDon(IstId); 
            rdgvIstektenAramaSonuclari.DataSource = ds
            rdgvIstektenAramaSonuclari.DataBind(); 
        } 
        protected void rdbtnIstekAra_SelectedIndexChanged(object sender, EventArgs e) 
        { 
            if (rdbtnIstekAra.SelectedIndex == 0)//YilIstekAltistek dan arama 
            { 
                pnlIstekNodanAra.Visible = true
                pnlIstIddenAra.Visible = false
                pnlCihazOzelliklerindenAra.Visible = false
            } 
            if (rdbtnIstekAra.SelectedIndex == 1)//IStIDdan arama 
            { 
                pnlIstekNodanAra.Visible = false
                pnlIstIddenAra.Visible = true
                pnlCihazOzelliklerindenAra.Visible = false
            } 
            if (rdbtnIstekAra.SelectedIndex == 2)//Cihaz Ozelliklerinden arama 
            { 
                pnlIstekNodanAra.Visible = false
                pnlIstIddenAra.Visible = false
                pnlCihazOzelliklerindenAra.Visible = true
            } 
            //rwDialog.Visible = false
        } 
        protected void btnCihazOzelliklerindenAra_Click(object sender, EventArgs e) 
        { 
            CihazOzelliklerindenAramadanGridiBagla(); 
        } 
        protected void CihazOzelliklerindenAramadanGridiBagla() 
        { 
            int BolgeKodu = DalClass.kal_BolgeKoduDon(Context.User.Identity.Name); 
            string SertNo = null
            string CihazAdi = null
            string Marka = null
            string Model = null
            string SeriNonull
            string Sorumlu = null
            if (txtCihazOzelliklerindenAraSertNo.Text.Trim() != "") 
            { 
                SertNo = txtCihazOzelliklerindenAraSertNo.Text.Trim(); 
            } 
            if(txtCihazOzelliklerindenAraCihazAdi.Text.Trim()!="") 
            { 
                CihazAdi=txtCihazOzelliklerindenAraCihazAdi.Text.Trim(); 
            } 
            if(txtCihazOzelliklerindenAraMarka.Text.Trim()!="") 
            { 
                Marka=txtCihazOzelliklerindenAraMarka.Text.Trim(); 
            } 
            if(txtCihazOzelliklerindenAraModel.Text.Trim()!="") 
            { 
                Model=txtCihazOzelliklerindenAraModel.Text.Trim(); 
            } 
            if(txtCihazOzelliklerindenAraSeriNo.Text.Trim()!="") 
            { 
                SeriNo=txtCihazOzelliklerindenAraSeriNo.Text.Trim(); 
            } 
            if (txtCihazOzelliklerindenAraSorumlu.Text.Trim() != "") 
            { 
                Sorumlu = txtCihazOzelliklerindenAraSorumlu.Text.Trim(); 
            } 
            DataSet ds=new DataSet(); 
            ds=DalClass.kal_CihazOzelliklerindenIstekAra(BolgeKodu,SertNo,CihazAdi,Marka,Model,SeriNo,Sorumlu); 
            rdgvIstektenAramaSonuclari.DataSource=ds
            rdgvIstektenAramaSonuclari.DataBind(); 
            ds.Dispose(); 
        } 
        protected void rdgvIstektenAramaSonuclari_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem) 
            { 
                 
                HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink"); 
                editLink.Attributes.Clear(); 
                editLink.Attributes["href"] = "#"; 
                editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ISTID"], e.Item.ItemIndex); 
            } 
        } 
     
        protected void Button1_Click(object sender, EventArgs e) 
        { 
     
        } 
     

    And now the problem rdgvFairmadanGelenIstekler_ItemCommand does't work I think because of rdgvIstektenAramaSonuclari was ajaxified.Thatswhy I am trying to use javascript to open the radwindow as like in your demo. But when I hit the link named EditLink in radgrid, it says

    "Microsoft JScript runtime error: Object doesn't support this property or method"
    at
     function ShowEditForm(id, rowIndex) { 
     
            window.radopen("UserControls/Pages/Istek.aspx?IstId=" + id, "RadWindow1"); 
            return false; 
        } 

    I should solve that problem. Thank you.
    Inanc
  20. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 15 Apr 2010 Link to this post

    Hi all,

    On response to Chanan: I checked the code and I can confirm it is all configured properly. The only case I can think of where it is possible to encounter issues is if the mentioned user control is loaded dynamically on the page. Let me know if this is true.

    And to Ungul: I assume the exception comes from the radopen() call you perform. Try adding RadWindowManager to the page and see if the error persists. However if you still prefer using a stand-alone RadWindow, then try opening it using the RadWindow object client-side API described here.

    Greetings,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  21. inanc
    inanc avatar
    17 posts
    Member since:
    Mar 2009

    Posted 15 Apr 2010 Link to this post

    Dear Lana,
    I don't know how to thank you. It works like a magic after adding a RadWindowManager as you said.
    I don't know the use of adding a RadWindowManager. But it works!

    Thank you very much and have a nice day. You made my day..

  22. Chanan Zass
    Chanan Zass avatar
    63 posts
    Member since:
    Aug 2012

    Posted 15 Apr 2010 Link to this post

    Thanks for responding.
    Actually the window is an aspx page (rather than a user control).
    Within this aspx page there's a dedicated RadAjaxManager, and two RadComboBoxes.
    The page is posted back in order to populate the second RadComboBox according to selected value in the first RadComboBox (this postback is the only aspect that is different from other similar scenarios we have working on various sites).

    The winodw closes alright after updating, but the original grid is not being refreshed.
    Debugging shows that there's an error in the original grid page (opening page):
    function refreshGrid(arg) {  
                if (!arg) {  
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");  
                }  
                else {  
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");  
                }  
            } 

    The error message is " 'null' is null or not an object) ."
    My only guess regarding 'null' is that it refers to oWindow: in our window page (aspx) we set:
    function GetRadWindow()  
            {  
                var oWindow = null;  
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)  
                      
                return oWindow;  
            } 
    This setting of oWindow remains null for some reason (possibly due to postback).

    A puzzle.
    Thank in advance, if anyone can help solving it.
  23. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 16 Apr 2010 Link to this post

    Hello Chanan,

    To address the issue you are facing, I would suggest you to open a formal support ticket and send me a runnable sample there. I will debug it and turn back to you with a proper resolution.

    Kind regards,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  24. Chanan Zass
    Chanan Zass avatar
    63 posts
    Member since:
    Aug 2012

    Posted 17 Apr 2010 Link to this post

    Thanks.
    I've decided to give it a last try and follow, to the letter, similar scenarios we have that work properly on other sites.
    Now everything works as it should.

    What works now includes:
    1. RadAjaxManager on the original page that includes a RadTabStrip (this was not there because the tabstrip worked fine also without an ajaxmanager).

    2. Changed the User Control holding the RadGrid:
    function OnClientClose(oWnd) {  
       $find("<%= RadAjaxManager2.ClientID %>").ajaxRequest("RebindAndNavigate");  
    }  
    function ShowEditForm(tyreId, rowIndex, carId) {  
       var oWnd = window.radopen("EditTyre.aspx?tid=" + tyreId + "&cid=" + carId, "TyreEditDialog");  
       oWnd.setSize(600, 250);  
       oWnd.center();  
       oWnd.add_close(OnClientClose);  
       return false;  

    What is added here is the line "oWnd.add_close(onClientClose)"  where we set the behavior upon window close, and we set it when opening the window.

    3. In the window page, we now need only:
    function GetRadWindow()  
            {  
                var oWindow = null;  
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)  
                      
                return oWindow;  
            }  
     
            function CloseWindow()  
            {  
                GetRadWindow().Close();       
            } 

    Grid rebinding occurs after each window closing.



  25. Brijesh Gadhiya
    Brijesh Gadhiya avatar
    7 posts
    Member since:
    Sep 2009

    Posted 01 Sep 2010 Link to this post

    Hello
    I am running into the same issue.
    I have a following level of nesting
    Page
        --> RadTabControl
            --> UserControl
                -->RadGrid.
    I have made a setup where a RadWindow pops open for editing a record of RadGrid.
    I fire an ajax request after the window is closed.
    I have verified that the ajax request from javascript gets fired and that server side method is called properly but the following does not work within the server side event of RadAjax Manager
    ((RadGrid)UserControl.FindControl("RadGrid")).Rebind();
    Please advise.
    Brijesh
  26. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Sep 2010 Link to this post

    Hi Brijesh,

    You can handle the RadAjaxManager AjaxRequest event dyrectly in the user control where the grid is situated. For more information, check the section at the bottom of this topic.

    Best wishes,
    Iana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  27. TSCGlobal
    TSCGlobal avatar
    43 posts
    Member since:
    Jan 2008

    Posted 16 Nov 2010 Link to this post

    I know this is an old post, but I was wondering if anyone could expand upon this by telling me how this could work using the AjaxManagerProxy control, as it does not seem to have an AjaxRequest handler? 

    Could I just call a function in the code behind file from the OnClientClose parameter instead of invoking an Ajaxrequest to the server?
  28. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 17 Nov 2010 Link to this post

    Hi beemer,

    In order to achieve your goal, you need to:

        - Add dynammic ajax setting where the RadAjaxmanager updates the grid. This is to be done in the Page_Load event of the Page where the RadGrid and the RadAjaxManagerProxy reside.
        - Invoke the ajax request in th OnClientClose event handler of the window as below:

    function WindowClose(args)
    {
        var manager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
        manager.ajaxRequest(args);
    }


        - handle the Ajaxrequest event in the Page where the RadGrid, the RadAjaxManagerProxy and the RadWindow reside as shown at the bottom of this topic:



    Kind regards,
    Iana
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top