我在gridView中添加了编辑列的触发事件,但是我要点击两遍“编辑”,单元格才处于可编辑状态。求教:如何点击一次“编辑”,就可以呈现编辑状态。
前台页面:
<sinopec:SmartGridView ID="gvList" runat="server" AllowSorting="True"
AutoGenerateColumns="False" CurrentSortDirection="Descending"
DataBindHandler="bindgvList" EmptyDataText="没有符合条件的数据" PagerBinding="pagerList"
SortButtonImageFold="~/Images/" Width="100%" CurrentSortExpression="Pcode"
AllowPaging="True" onrowcancelingedit="gvList_RowCancelingEdit"
onrowediting="gvList_RowEditing" onrowupdating="gvList_RowUpdating">
<Columns>
<asp:BoundField DataField="TID" HeaderText="外键" SortExpression="TID"
Visible="false">
</asp:BoundField>
<asp:BoundField DataField="Manufacturerse" HeaderText="厂商"
SortExpression="Manufacturerse">
</asp:BoundField>
<asp:BoundField DataField="SolutionTime" HeaderText="平均解决时间"
SortExpression="SolutionTime">
</asp:BoundField>
<asp:BoundField DataField="QuestionNum" HeaderText="问题数量"
SortExpression="QuestionNum">
</asp:BoundField>
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
</Columns>
</sinopec:SmartGridView>
后台代码:
protected void gvList_RowEditing(object sender, GridViewEditEventArgs e)
{
this.gvList.EditIndex = e.NewEditIndex;
}
你用的是SmartGridView
请查看对应的属性设置或API
this.gvList.EditIndex = e.NewEditIndex;后面重新绑定一次