ASPxGridView1没有自带的单击,双击事件,所以要自己写,
<script language="javascript" type="text/javascript"><!-- function OnGridFocusedRowChanged() { var t = grid.GetRowValues(grid.GetFocusedRowIndex(), 'sheet_no', OnGetRowValues); } function OnGetRowValues(values) { var notes = document.getElementById("<%=grid.ClientID%>"); notes.value = values; alert(values.tostring()); } //--> </script>
然后,下面红色地方,加入此代码就可以啦
<dx:ASPxGridView ID="grid" runat="server" KeyFieldName="sheet_no" AutoGenerateColumns="False" ClientIDMode="AutoID" OnSelectionChanged="Page_Load" OnDataBound="grid_DataBound" OnFocusedRowChanged="grid_FocusedRowChanged" OnDetailRowExpandedChanged="grid_DetailRowExpandedChanged" OnDetailsChanged="grid_DetailsChanged" Width="490px"> <ClientSideEvents FocusedRowChanged="function(s, e) { }" RowClick="function(s, e) { OnGridFocusedRowChanged(); }" /> <Columns>
FocusedRowChanged 选中值改变事件
RowClick 单击事件
RowDbClick 双击事件