0
我使用下面的代碼試圖讓用戶通過點擊行上的任何地方(加上鼠標懸停和放開)來選擇一個gridview行。該代碼似乎不適用於rowdatabound,我無法闖入事件。 (有線)。ASP.Net - Gridview的行選擇和效果
該控件位於一個用戶控件中,該控件位於具有主頁面的內容頁面中。
protected void gvOrderTypes_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridView gvOrdTypes = (GridView)sender;
//check the item being bound is actually a DataRow, if it is,
//wire up the required html events and attach the relevant JavaScripts
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "javascript:setMouseOverColor(this);";
e.Row.Attributes["onmouseout"] = "javascript:setMouseOutColor(this);";
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvOrdTypes, "Select$" + e.Row.RowIndex);
}
}