前台JS代码
function grdSelect(intIndex){
var intCount;
intCount = document.all("hideCount").value;
document.all("sqlFlag").value = intIndex;
for(i = 0; i < intCount; i++){
if(i == intIndex){
grdType.rows(intIndex).bgColor="#FFFACD";
document.all("txtType").value=grdType.rows(intIndex).cells(1).innerText;
}
else
grdType.rows(i).bgColor="#FFFFFF";
}
}

后台_ItemDataBound代码
Private Sub grdType_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdType.ItemDataBound
e.Item.Attributes.Add("onclick", "grdSelect(" & e.Item.ItemIndex & ");")
End Sub

Back