0
我無法在GridView選擇行
,我有javascript代碼gridview的行用JavaScript
function SelectRow(row) {
var _selectColor = "#303030";
var _normalColor = "#909090";
var _selectFontSize = "3em";
var _normalFontSize = "2em";
// get all data rows - siblings to current
var _rows = row.parentNode.childNodes;
// deselect all data rows
try {
for (i = 0; i < _rows.length; i++) {
var _firstCell = _rows[i].getElementsByTagName("td")[0];
_firstCell.style.color = _normalColor;
_firstCell.style.fontSize = _normalFontSize;
_firstCell.style.fontWeight = "normal";
}
}
catch (e) { }
// select current row (formatting applied to first cell)
var _selectedRowFirstCell = row.getElementsByTagName("td")[0];
_selectedRowFirstCell.style.color = _selectColor;
_selectedRowFirstCell.style.fontSize = _selectFontSize;
_selectedRowFirstCell.style.fontWeight = "bold";
}
和對電網的數據綁定事件我有
protected void GridView1_DataBound(object sender, EventArgs e)
{
foreach (GridViewRow Row in GridView1.Rows){
if (e.Row.RowType == DataControlRowType.DataRow)
{
// javascript function to call on row-click event
e.row.Attributes.Add("onClick", "javascript:void SelectRow(this);");
}
}
}
,但此行給出錯誤
if(e.RowType == DataControlRowType.DataRow)錯誤消息:'System.EventArgs'不包含'row'的定義,n Ø 擴展方法「行」接受 類型的第一個參數「System.EventArgs」可以找到(是否缺少using指令 或程序集引用?)
感謝