重写render利用ClientScript在客户端注册select回发到服务器触发服务器端的行选择事件 protected override void Render(HtmlTextWriter writer) { foreach (GridViewRow row in gvHeaderRows) { if (rowRowType == DataControlRowTypeDataRow) { rowAttributes[onclick] = ClientScriptGetPostBackEventReference(gvHeader Select$ + rowRowIndexToString() true);
rowAttributes[style] = cursor:pointer; rowAttributes[title] = 单击选择行;
} } baseRender(writer); } |