重寫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);
}
From:http://tw.wingwit.com/Article/program/net/201311/12292.html