WebDatagrid中添加打开新tab的超链接列
方法一:前台使用
function openTab() { var grid = $find("grdVendor"); var row = grid.get_behaviors().get_selection().get_selectedRows().getItem(0); var id = row.get_cell(0).get_value(); var name = row.get_cell(1).get_value(); var url = document.location.search; var ua = "../VenApprise/LookAppraise.aspx?venId=" + escape(id) + "&venName=" + escape(name) + ""; parent.AddTab(ua, '查看评价'); }
//在模板行中添加一行 <asp:LinkButton runat="server" ID="lnkLook" Text="查看" ForeColor="Blue" Font-Size="10.5pt" CommandName="Look" OnClientClick="openTab()" CommandArgument="" />
方法二:后台表格初始化是绑定连接
protected void WDGridExam_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e) { LinkButton link = e.Row.Items[6].FindControl("link") as LinkButton; string a = e.Row.DataKey[0].ToString(); string b = e.Row.DataKey[1].ToString(); string txt = "select a.pk_type,b.cProcName,b.cHistoryName,b.cSuppleData from ED_sheetName a inner join ED_sheetType b on a.pk_type=b.pk_type " + " where a.sheetCode='" + b + "' "; DataTable table = m_user.GetTable(txt); if (link.Text == "未审核") { string url = string.Format("" + table.Rows[0][3].ToString() + "?sheetCode={0}&cMonth={1}", b, a); link.ToolTip = "点击修改数据"; string sAct = "parent.AddTab('@url','@title')"; sAct = sAct.Replace("@url", url); sAct = sAct.Replace("@title", "修改数据"); link.OnClientClick = sAct; } else if (link.Text == "未上传") { } }