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

Javascript does not pop up

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kanat
Top achievements
Rank 1
Kanat asked on 14 Feb 2011, 10:12 AM

hi, 

I have Grid with 1 DetailTable, and there are static columns with GridButtonColumns, clicking which should open new page with  parameter.

The call to popup page is in code behind:

if (e.CommandName == "History")
                {
                    popupScript = "<script language='javascript'>" +
                                    "window.open('History.aspx?code=" + codeStr + "'," +
                                    "'_blank', 'scrollbars=yes, resizable=yes,status=yes," +
                                    "location=yes, toolbar=yes, menubar=yes,top = 0, left = 0, target='_self')" +
                                    "</script>";
  
                    ClientScript.RegisterStartupScript(cstype, "History", popupScript);
                    //Page.RegisterStartupScript("???????", popupScript);
                }

In debug mode, I put breakpoint in - ClientScript.RegisterStartupScript(cstype,"History", popupScript);

It reaches there, but the page is not poped up. What I am doing wrong ?

Here is aspx code:

<div>
       <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
       </telerik:RadScriptManager>
       <!-- content start -->
       <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RBL_UType">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="panelTest_DIV" />
                       <telerik:AjaxUpdatedControl ControlID="RadSplitter1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="RBtn_Search">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadSplitter1" LoadingPanelID="RadAjaxLoadingPanel1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="RG_SearchResult">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RG_SearchResult" LoadingPanelID="RadAjaxLoadingPanel1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
       </telerik:RadAjaxLoadingPanel>
       <!-- content end -->
       <asp:RadioButtonList ID="RBL_UType" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
           AutoPostBack="True">
           <asp:ListItem Value="0">??????????</asp:ListItem>
           <asp:ListItem Value="1">???????????</asp:ListItem>
       </asp:RadioButtonList>
       <br />
       <div id="panelTest_DIV" title="?????? ?? ???????? ??? ???" runat="server">
           <asp:Panel ID="panelTest" runat="server">
               <table>
                   <tr>
                       <td>
                           <asp:Label ID="LBL_Surname" runat="server" Text="???????:" Visible="false"></asp:Label>
                       </td>
                       <td>
                           <asp:TextBox ID="TB_Surname" runat="server" Visible="false"></asp:TextBox>
                       </td>
                   </tr>
                   <tr>
                       <td>
                           <asp:Label ID="LBL_Name" runat="server" Text="???:" Visible="false"></asp:Label>
                       </td>
                       <td>
                           <asp:TextBox ID="TB_Name" runat="server" Visible="false"></asp:TextBox>
                       </td>
                   </tr>
                   <tr>
                       <td>
                       </td>
                       <td>
                           <telerik:RadButton runat="server" ID="RBtn_Search" OnClick="RB_Search_Click" Text="?????"
                               Visible="false" Skin="Telerik">
                           </telerik:RadButton>
                       </td>
                   </tr>
               </table>
           </asp:Panel>
       </div>
       <br />
       <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" 
               Style="margin-top: 0px" Height="100%">
           <telerik:RadPane ID="RadPane1" runat="server" Width="100%" Visible="false">
               <telerik:RadGrid ID="RG_SearchResult" runat="server" OnItemDataBound="RG_SearchResult_ItemDataBound"
                   OnNeedDataSource="RG_SearchResult_NeedDataSource" OnDetailTableDataBind="RG_SearchResult_DetailTableDataBind"
                   OnItemCommand="RG_SearchResult_ItemCommand" DataSourcePersistenceMode="NoPersistence"
                   HeaderStyle-Font-Bold="true" Width="100%" PageSize="1000" PagerStyle-AlwaysVisible="true"
                   ShowStatusBar="True" Visible="false" AllowPaging="false" Skin="Telerik">
                   <MasterTableView Name="Level1" DataKeyNames="ID">
                       <Columns>
                           <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" Visible="false" />
                       </Columns>
                       <DetailTables>
                           <telerik:GridTableView Name="Level2" DataKeyNames="ID" HierarchyLoadMode="ServerOnDemand"
                               Width="100%" BackColor="#EFEFFB">
                               <Columns>
                                   <telerik:GridButtonColumn CommandName="RollInfo" Text="???????" UniqueName="RollInfo" />
                                   <telerik:GridButtonColumn CommandName="History" Text="???????" UniqueName="History" />
                                   <telerik:GridButtonColumn CommandName="TechSpec" Text="???. ?????????" UniqueName="TechSpec" />
                                   <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID" Visible="false" />
                                   <telerik:GridBoundColumn DataField="PropCode" HeaderText="???" UniqueName="PropCode" />
                                   <telerik:GridBoundColumn DataField="PropAddr" HeaderText="?????" UniqueName="PropAddr" />
                                   <telerik:GridBoundColumn DataField="Owner" HeaderText="???" UniqueName="Owner" />
                               </Columns>
                               <PagerStyle AlwaysVisible="True"></PagerStyle>
                           </telerik:GridTableView>
                       </DetailTables>
                       <ExpandCollapseColumn Visible="True">
                       </ExpandCollapseColumn>
                       <PagerStyle AlwaysVisible="True"></PagerStyle>
                   </MasterTableView><HeaderStyle Font-Bold="True"></HeaderStyle>
                   <PagerStyle AlwaysVisible="True"></PagerStyle>
               </telerik:RadGrid></telerik:RadPane>
       </telerik:RadSplitter>
   </div>
 

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 16 Feb 2011, 09:52 AM
Hi Kanat,

Your window.open() script is not well formed. Particularly, you have a set of breaking single quotes. The correct string should be:

if (e.CommandName == "History")
{
    popupScript = "<script language='javascript'>" +
                    "window.open('History.aspx?code=" + codeStr + "'," +
                    "'_blank', 'scrollbars=yes, resizable=yes,status=yes," +
                    "location=yes, toolbar=yes, menubar=yes,top = 0, left = 0, target=\"_self\"')" +
                    "</script>";
 
    ClientScript.RegisterStartupScript(cstype, "History", popupScript);
    //Page.RegisterStartupScript("???????", popupScript);
}


Veli
the Telerik team
Browse the vast support resources we have to jump start 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.
Tags
Grid
Asked by
Kanat
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or