opening 2nd pop up on edit pop up of rad grid

3 posts, 0 answers
  1. Webster Velasco
    Webster Velasco avatar
    114 posts
    Member since:
    Jun 2012

    Posted 30 Nov 2009 Link to this post

    hi

    im trying to edit a radgrid row using pop up mode..

    here is my problem

    on my pop up edit form i want to open a 2nd pop up but cant make it.. my first pop up is working while the 2nd not.



    here is my code

    radgrid aspx code:
    <%@ Page Language="vb"MasterPageFile="Main.Master" AutoEventWireup="false" CodeBehind="UTEPagine.aspx.vb" Inherits="WebBIODemo.UTEPagine" %> 
      
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
     
    <asp:Content ID="Content1" ContentPlaceHolderID="cphMain" Runat="Server">  
      <div style="height:500px">  
          <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
          </telerik:RadScriptManager>  
     
        <!-- content start --> 
         
        <div> 
           <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
                <script type="text/javascript"
                function ShowEditForm(id, rowIndex) 
                { 
                    var grid = $find("<%= grdUTEPagine.ClientID %>"); 
                     
                    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element(); 
                    grid.get_masterTableView().selectItem(rowControl, true); 
                             
                    window.radopen("EditUTEPagineDemo.aspx?Id=" + id, "UserListDialog"); 
                    return false; 
                } 
                function ShowInsertForm() 
                { 
                   window.radopen("EditUTEPagineDemo.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("EditUTEPagineDemo.aspx?Id=" + eventArgs.getDataKeyValue("EmployeeID"), "UserListDialog"); 
                } 
                </script> 
            </telerik:RadCodeBlock> 
             
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
                    <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> 
                <telerik:RadGrid 
                    OnItemCreated="grdUTEPagine_ItemCreated" 
                    ID="grdUTEPagine" 
                    runat="server" 
                    AllowPaging="True" 
                    Width="97%" 
                    DataSourceID="objDS"
                    <PagerStyle Mode="NumericPages" /> 
                    <MasterTableView 
                        AutoGenerateColumns="False" 
                        DataKeyNames="CODICELINGUA,CODICEFORM" 
                        ClientDataKeyNames="CODICELINGUA,CODICEFORM" 
                        Width="100%" 
                        CommandItemDisplay="Top" 
                        PageSize="15"
                        <Columns> 
                            <telerik:GridTemplateColumn UniqueName="EditRecord" AllowFiltering="False" Resizable="False">                            
                                <ItemTemplate> 
                                    <asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink> 
                                </ItemTemplate> 
                                <HeaderStyle Width="24px" /> 
                            </telerik:GridTemplateColumn> 
     
                               <telerik:GridBoundColumn DataField="DESCRIZIONE" HeaderText="Descrizione" SortExpression="DESCRIZIONE"  
                                    UniqueName="colDESCRIZIONE" FilterImageToolTip="Filtro per descrizione" Resizable="true">  
                                    <HeaderStyle Width="310px" />  
                                </telerik:GridBoundColumn>        
                                          
                                <telerik:GridBoundColumn DataField="DESCRIZIONEAIUTO" HeaderText="Descrizione AIUTO" SortExpression="DESCRIZIONEAIUTO"  
                                    UniqueName="colDESCRIZIONEAIUTO" FilterImageToolTip="Filtro per descrizione inglese" Resizable="true">  
                                    <HeaderStyle Width="310px" />  
                                </telerik:GridBoundColumn>                    
      
                                <telerik:GridBoundColumn DataField="ANNOTAZIONI" HeaderText="ANNOTAZIONI" SortExpression="ANNOTAZIONI"  
                                    UniqueName="colANNOTAZIONI" FilterImageToolTip="Filtro per descrizione inglese" Resizable="true">  
                                    <HeaderStyle Width="310px" />  
                                </telerik:GridBoundColumn>    
                                                         
                            <telerik:GridButtonColumn ConfirmText="Eliminare Utente Pagina?" ButtonType="ImageButton" ImageUrl="_img/Delete.gif" CommandName="Delete" Text="Elimina" UniqueName="colDelete"
                                <HeaderStyle Width="20px" /> 
                            </telerik:GridButtonColumn>  
     
                        </Columns> 
                        <CommandItemTemplate> 
                            <href="#" onclick="return ShowInsertForm();">Add New Record</a> 
                        </CommandItemTemplate> 
                    </MasterTableView> 
                    <ClientSettings> 
                        <Selecting AllowRowSelect="true" /> 
                        <ClientEvents OnRowDblClick="RowDblClick" /> 
                    </ClientSettings> 
                </telerik:RadGrid> 
                 
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
                    <Windows> 
                        <telerik:RadWindow ID="UserListDialog" runat="server" Title="Editing record" Height="700px" 
                            Width="300px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" /> 
                    </Windows> 
                </telerik:RadWindowManager> 
        <asp:ObjectDataSource   
            ID="objDS"   
            runat="server"   
            SelectMethod="selectUTEPagine"  
            UpdateMethod="updateUTEPagine"  
            InsertMethod="insertUTEPagine"        
            DeleteMethod="deleteUTEPagine"        
            SortParameterName="orderBy"  
            TypeName="GestioneLingue"  
            ConflictDetection="CompareAllValues"  
            OldValuesParameterFormatString="orig_{0}">  
            <SelectParameters>  
                <asp:ControlParameter ControlID="grdUTEPagine" Name="filterBy" PropertyName="MasterTableView.FilterExpression" Type="String" />  
            </SelectParameters>  
              
            <UpdateParameters>  
                <asp:Parameter Name="CODICELINGUA" Type="String" />  
                <asp:Parameter Name="CODICEFORM" type="Int32" />  
                <asp:Parameter Name="DESCRIZIONE" Type="String" />  
                <asp:Parameter Name="DESCRIZIONEAIUTO" Type="String" />  
                <asp:Parameter Name="ANNOTAZIONI" Type="String" />  
                <asp:Parameter Name="orig_CODICELINGUA" Type="String" />  
                <asp:Parameter Name="orig_CODICEFORM" Type="Int32" />  
            </UpdateParameters>  
              
            <InsertParameters>  
                <asp:Parameter Name="CODICELINGUA" Type="String" />  
                <asp:Parameter Name="CODICEFORM" type="Int32" />  
                <asp:Parameter Name="DESCRIZIONE" Type="String" />  
                <asp:Parameter Name="DESCRIZIONEAIUTO" Type="String" />  
                <asp:Parameter Name="ANNOTAZIONI" Type="String" />  
            </InsertParameters>  
              
            <DeleteParameters>  
                <asp:Parameter Name="orig_CODICELINGUA" Type="String" />  
                <asp:Parameter Name="orig_CODICEFORM" Type="Int32" />  
            </DeleteParameters>  
              
        </asp:ObjectDataSource>         
          </div>  
      </div>  
    </asp:Content>  

    radgrid codebehind:
    Imports System 
    Imports System.Data 
    Imports System.Configuration 
    Imports System.Collections 
    Imports System.Web 
    Imports System.Web.Security 
    Imports System.Web.UI 
    Imports System.Web.UI.WebControls 
    Imports System.Web.UI.WebControls.WebParts 
    Imports System.Web.UI.HtmlControls 
     
    Imports Telerik.Web.UI 
    Partial Public Class UTEPagine 
        Inherits System.Web.UI.Page 
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
     
        End Sub 
        Protected Sub grdUTEPagine_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) 
            If TypeOf e.Item Is GridDataItem Then 
                Dim editLink As HyperLink = DirectCast(e.Item.FindControl("EditLink"), HyperLink) 
                Dim idCL As String = DirectCast(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("CODICELINGUA"), String) 
                Dim idCF As Integer = DirectCast(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("CODICEFORM"), Integer) 
                Dim id As String 
                id = idCL.ToString() & "|" & idCF.ToString() 
                editLink.Attributes("onclick") = [String].Format("return ShowEditForm('{0}','{1}');", id.ToString(), e.Item.ItemIndex) 
            End If 
        End Sub 
     
        Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest 
            If e.Argument = "Rebind" Then 
                grdUTEPagine.MasterTableView.SortExpressions.Clear() 
                grdUTEPagine.MasterTableView.GroupByExpressions.Clear() 
                grdUTEPagine.Rebind() 
            ElseIf e.Argument = "RebindAndNavigate" Then 
                grdUTEPagine.MasterTableView.SortExpressions.Clear() 
                grdUTEPagine.MasterTableView.GroupByExpressions.Clear() 
                grdUTEPaginegrdUTEPagine.MasterTableView.CurrentPageIndex = grdUTEPagine.MasterTableView.PageCount - 1 
                grdUTEPagine.Rebind() 
            End If 
        End Sub 
    End Class 

    edit from aspx code:
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="EditUTEPagineDemo.aspx.vb" Inherits="WebBIODemo.EditUTEPagineDemo" %> 
     
    <%@ 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 id="Head1" runat="server"
        <title>WebBIO Demo</title> 
        <link href="../_styles/main.css" type="text/css" rel="stylesheet" /> 
    </head> 
     
    <body style="margin:0px;height:100%;overflow:hidden" scroll="yes"
        <form id="EditUTEPagine" runat="server"  style="height:100%;margin:0px;" method="post"
       <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();      
            } 
     
     
             function OpenWin(cod) 
                { 
                    var oWnd = radopen("Zoom.aspx?KA=" + cod, "rdwCodiceLingue"); 
                } 
             function OnClientClose(sender, args) { 
                    var arg = args.get_argument();  
                    var QualeControllo;  
                    if (arg != null) {  
                        if (arg.KA == "CL"){ 
                            QualeControllo = document.getElementById("<%= txtCODICELINGUA.ClientID %>"); 
                        } 
                        else{ 
                            QualeControllo = document.getElementById("<%= txtCODICEFORM.ClientID %>"); 
                        } 
                        QualeControllo.value = arg.codice;  
                    }  
                }  
        </script>      
        <div> 
          <asp:Label runat="server" ID="injectScript" Visible="true" Text="" ></asp:Label> 
          <asp:HiddenField runat="server" ID="lblIDtabella" Value="" /> 
          <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
          <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" /> 
          <telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientClose="OnClientClose">  
            <Windows>  
                <telerik:RadWindow runat="server" Title="WebBIO Zoom" Behaviors="none" Animation="FlyIn" DestroyOnClose="true"   
                    Left="" ID="rdwCodiceLingue"  NavigateUrl="Zoom.aspx" /> 
            </Windows> 
          </telerik:RadWindowManager>       
     
          <table cellspacing="5" cellpadding="5" border="0" width="500px"
            <tr> 
                <th colspan="2"><asp:label ID="lblTitle" runat="server" /></th
            </tr> 
            <tr> 
                <td> 
                    <asp:Label ID="lblCODICELINGUA" Text="Codice Lingua: " runat="server" /> 
                </td> 
                <td> 
                    <asp:ImageButton ID="cmdZOOMcodL" OnClientClick="OpenWin('CL')" runat="server"  ImageUrl="_img/lens.gif" /> 
                    <asp:textbox ID="txtCODICELINGUA"  runat="server" Enabled="false" MaxLength="4" /> 
                </td> 
            </tr> 
            <tr> 
                <td> 
                    <asp:label ID="lblCODICEFORM" Text="Codice Form: " runat="server" /> 
                </td> 
                <td> 
                    <asp:ImageButton ID="cmdZOOMcodF" OnClientClick="OpenWin('CF')" runat="server" ImageUrl="_img/lens.gif" /> 
                    <asp:textbox ID="txtCODICEFORM" runat="server" Enabled="false" /> 
                </td>             
            </tr> 
            <tr> 
                <td> 
                    <asp:Label ID="lblDESCRIZIONE" Text="Descrizione: " runat="server" /> 
                </td> 
                <td> 
                    <telerik:RadTextBox ID="rdtDESCRIZIONE" runat="server" TextMode="MultiLine" Width="220px" Height="130px" /> 
                </td> 
            </tr> 
            <tr> 
                <td valign="middle" align="center"
                    <asp:Label ID="lblDESCRIZIONEAIUTO" Text="Descrizione aiuto: " runat="server" /> 
                </td> 
                <td> 
                    <telerik:RadTextBox ID="rdtDESCRIZIONEAIUTO" runat="server" TextMode="MultiLine" Width="220px" Height="130px" /> 
                </td> 
            </tr> 
            <tr> 
                <td valign="middle" align="center"
                    <asp:Label ID="Label1" Text="Descrizione aiuto: " runat="server" /> 
                </td> 
                <td> 
                    <telerik:RadTextBox ID="rdtANNOTAZIONI" runat="server" TextMode="MultiLine" Width="220px" Height="130px" /> 
                </td> 
            </tr> 
                <tr><td colspan="2" style="height:10px"></td></tr>                           
                <tr> 
                    <td> 
                        <asp:ValidationSummary ID="vsSummary" runat="server" Enabled="true" DisplayMode="BulletList" ShowSummary="false" ShowMessageBox="true" EnableClientScript="true" HeaderText="I seguenti campi devono essere valorizzati correttamente :"/> 
                    </td> 
                </tr> 
                <tr> 
                    <td colspan="2" style="text-align:right;"
                        <table cellpadding="0" cellspacing="10px" width="100%"
                            <tr> 
                                <td width="95%"></td> 
                                <td><asp:Button runat="server" id="btnSave" Text="Salva" OnClick="btnSave_Click" Width="80px"/></td> 
                                <td><button id="btnCancel" runat="server" onclick="closeRadWindow()" style="width:80px">Annulla</button></td
                            </tr> 
                        </table>                     
                    </td> 
                </tr> 
                <tr> 
                    <td colspan="2"><asp:Label runat="server" ID="lblErrorMsg" Text=""></asp:Label></td
                </tr>         
          </table> 
     
        </div> 
    </form> 
    </body> 
    </html> 
    2nd pop up aspx code:
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Zoom.aspx.vb" Inherits="WebBIODemo.Zoom" %> 
     
    <%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %> 
    <%@ Register Assembly="RadWindow.Net2" Namespace="Telerik.WebControls" TagPrefix="radW" %> 
     
    <!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 id="Head1" runat="server"
        <title>Pagina senza titolo</title> 
    </head> 
    <body> 
        <form id="Zoom" runat="server"
      <div> 
        <script type="text/javascript">  
     
            function closeWindow(sender, args) { 
                var oArg = new Object(); 
      
                 oArg.codice = args.getDataKeyValue("CODICELINGUA");  
                 oArg.KA = "CL" 
                debugger;  
                var oWnd = GetRadWindow();  
                var dialog1 = oWnd.get_windowManager().getWindowByName("rdwCodiceLingue");   
                var contentWin = dialog1.get_contentFrame().contentWindow 
                 contentWin.Rargs(oArg);    
                oWnd.close();  
            }  
            function closeWindow2(sender, args) {  
                var oArg = new Object(); 
                         
                oArg.codice = args.getDataKeyValue("CODICEFORM"); 
                oArg.KA = "CF"  
                debugger;  
                var oWnd = GetRadWindow();  
                var dialog1 = oWnd.get_windowManager().getWindowByName("rdwCodiceLingue");   
                var contentWin = dialog1.get_contentFrame().contentWindow 
                 contentWin.Rargs(oArg);    
                oWnd.close();  
            }  
            function GetRadWindow() {  
                   var oWindow = null
                   if (window.radWindow) oWindow = window.radWindow; 
                   else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
                   return oWindow; 
            } 
             
        
        </script> 
         
            <table cellspacing="0"
                <tr> 
                    <th><asp:Label ID="lblTITOLO" runat="server" /></th
                </tr> 
                <tr> 
                    <td> 
                        <radG:RadGrid ID="grdCL" runat="server" AutoGenerateColumns="false" > 
                            <ClientSettings> 
                                <Selecting AllowRowSelect="true" /> 
                                <ClientEvents OnRowSelected="closeWindow" /> 
                            </ClientSettings> 
                            <MasterTableView DataKeyNames="CODICELINGUA,DESCRIZIONE"
                                <Columns> 
                                    <radG:GridBoundColumn DataField="CODICELINGUA" HeaderText="Codice Lingua" /> 
                                    <radG:GridBoundColumn DataField="DESCRIZIONE" HeaderText="Descrizione" /> 
                                </Columns> 
                            </MasterTableView> 
                        </radG:RadGrid> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        <radG:RadGrid ID="grdCF" runat="server" AutoGenerateColumns="false" > 
                            <ClientSettings EnableRowHoverStyle="true"
                                <Selecting AllowRowSelect="true" /> 
                                <ClientEvents OnRowSelected="closeWindow2" /> 
                            </ClientSettings> 
                            <MasterTableView DataKeyNames="CODICEFORM,DESCRIZIONE"
                                <Columns> 
                                    <radG:GridBoundColumn DataField="CODICEFORM" HeaderText="Codice Lingua" /> 
                                    <radG:GridBoundColumn DataField="DESCRIZIONE" HeaderText="Descrizione" /> 
                                </Columns> 
                            </MasterTableView> 
                        </radG:RadGrid> 
                    </td> 
                </tr> 
            </table>      
        </div> 
        </form> 
    </body> 
    </html> 



  2. Webster Velasco
    Webster Velasco avatar
    114 posts
    Member since:
    Jun 2012

    Posted 01 Dec 2009 Link to this post

    hi.. my pop is working now but i have new problem.. cant get the return value of my 2nd pop up..

    i want to to get the return value and make it as the value of my txtCODICELINGUA
    plz help me
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 03 Dec 2009 Link to this post

    Hi Webster,

    Please take a look at the Returning Values from a Dialog demo showing how the desired by you functionality can be achieved. 

    Sincerely yours,
    Mira
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top