Linkbutton不适用于Google Chrome

时间:2014-09-10 07:41:03

标签: javascript asp.net google-chrome

在下面的代码中,我在datagrid中有链接按钮,当我点击链接按钮时它没有打开chrome中的弹出窗口,而在IE和Mozilla中它工作正常。请帮助我解决问题。

 <asp:TemplateColumn HeaderText="From Quote" ItemStyle-Width="200px">
                            <ItemTemplate>                                              
                                <asp:LinkButton ID="lnkQuote" runat="server" CommandName="Quote" Text="Quote" />
                            </ItemTemplate>        
                          </asp:TemplateColumn> 

 if (e.CommandName.Equals("Quote"))
                {
  Label KK = (Label)dgPOD.Items[e.Item.ItemIndex].Cells[1].FindControl("TXT1");
                    Label lbl = (Label)dgPOD.Items[e.Item.ItemIndex].Cells[1].FindControl("LBL1");
                    str1 = KK.Text.ToString();
                    str2 = lbl .Text.ToString();

                    ScriptManager.RegisterStartupScript(this, GetType(), "ShowPopUp", "ShowPopUp()", true);
                }    

3 个答案:

答案 0 :(得分:1)

添加此代码。它会正常工作。

      <!DOCTYPE html>
      <!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 runat="server">
<meta http-equiv="X-UA-TextLayoutMetrics" content="natural" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>

如果有帮助,请投票。

答案 1 :(得分:0)

尝试添加周围的脚本标记

ScriptManager.RegisterStartupScript(this, GetType(), "ShowPopUp", "<script type=\"text/javascript\">ShowPopUp();</" + "script>", true);

答案 2 :(得分:0)

ClientScript.RegisterStartupScript(this.GetType(), "ShowPopUp", "ShowPopUp()", true);