2011-05-06 56 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> 

希望它有帮助。

相关问题