Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
695
Opening a new window using TargetUrl
posted

I'm using a web grid and I am using TargetUrl to assign a link.

his.webGrid.Rows[i].Cells.FromKey("Name").TargetURL = "Item.aspx?id=" + Id;

But this link is opening a new page on the same page but I wanted to open a new window for this page. Could you please help me?

Updated

I found this code in this forum and it is working fine but it is opening the explorer but unfocused. It opens the window and keep the current window focused. Am I making any mistakes?

protected void runsdetailWebGrid_InitializeRow(object sender, RowEventArgs e)

{

string pathStr = "file:" + e.Row.Cells.FromKey("Path").Value.ToString();string href = String.Format("<a href='{0}' target='_blank'> <img src='Images/folderstep2.GIF' style='border-style: none' /></a>", pathStr);

e.Row.Cells[0].Value = href;

}

 

Parents
No Data
Reply
  • 640
    posted
    You can open the second window and keep the focus on the second window if you use the Window.setTimeout() method. For example, I want to launch a second window (who's name is based upon the value of the current cell) over the primary window when a cell is clicked.
    function PODetailsGrid_CellClickHandler(gridName, cellId, button){
        var currentCell = igtbl_getCellById(cellId);
         
        convChartWindow = window.open("conversioncharts/" + currentCell.getValue() + ".html", "chart", "location=0,0, status=1, scrollbars=1, width=" + screen.width + ", height=175");                
        self.setTimeout('setWindowFocus(convChartWindow)', 1000) 
    }
    
    function setWindowFocus(w)
    {
      w.focus();
    }
    
Children
No Data