右键单击gridview中的linkbutton不会打开新选项卡

时间:2013-11-28 11:41:37

标签: c# asp.net gridview right-click linkbutton

我在gridview控件中使用了一个linkbutton。我想打开一个新选项卡的链接。链接按钮:

<asp:LinkButton ID="lbtnEditCompany" CssClass="ahrefSearch" Text="Select" runat="server" OnClick="lbtnEditCompany_Click"  />

源代码:

protected void lbtnEditCompany_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton button = (LinkButton)sender;
           SiteID = button.CommandArgument;
            DataSet set = DataAccess.GetAllCorporateSites(SearchbyAlphabet, SessionManager.SaleID, SearchbyAssociate);
            string str = "";
            for (int i = 0; (i < set.Tables[0].Rows.Count) && (str == ""); i++)
            {
                if (SiteID == set.Tables[0].Rows[i]["ID"].ToString())
                {
                    str = set.Tables[0].Rows[i]["CompanyName"].ToString();
                }
            }
            SessionManager.WidgetId = Convert.ToInt32(SiteID);
            SessionManager.SalesPersonSiteName = str;
           base.Response.Redirect("~/Corporate/WidgetDetails.aspx", false);                
        }
        catch (Exception exception)
        {
            HandlePageError(exception);
        }
    }

1 个答案:

答案 0 :(得分:0)

尝试以下代码

Response.Write(String.Format("window.open('{0}','_blank')", ResolveUrl("~/Corporate/WidgetDetails.aspx")));