简体   繁体   中英

right click on linkbutton in gridview is not opening into new tab

I am using a linkbutton within a gridview control.I want to open the link into a new tab. Link button:

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

Source Code :

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);
        }
    }

尝试下面的代码

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM