2011-05-06 80 views

回答

0

您需要點擊綁定與網格視圖控件

的行事件的彈出

下面的代碼只是演示給你

下面的JavaScript打開,你需要通過URL的彈出窗口,你想

<script> 
    function popWin(url){ 
     window.open(url, '', '');"); 
    } 
    </script> 

follwing是attch腳本與gridview的行開拓彈出

code behind 

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    if(e.Row.RowType == DataControlRowType.DataRow) 
    {    
     string url = "www.google.com"; 
     e.Row.Attributes.Add("onclick","popWin('" + url + "')"); 
    } 
} 
0

我曾與Response.Redirect的同樣的問題,所以就用ASP samle代碼:超鏈接按鈕來代替。我通過將它綁定到SQL數據庫來加載URL。這裏是代碼:

<asp:TemplateField HeaderText="Google Map"> 
    <ItemTemplate> 
     <asp:HyperLink runat="server" ID="hlGMap" Target="_blank" Text="Map" ImageUrl="~/gfx/google.png" NavigateUrl='<%# Bind("GoogleMapsURL") %>' /> 
    </ItemTemplate> 
</asp:TemplateField> 

希望它有幫助。

相關問題