我的asp.net项目中有GrideView,我想只编辑两列,
我使用Read-Only="true"
属性,但问题是在编辑了两列后,其他人的数据变空了!
请帮我解决这个问题。
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="RNum" DataNavigateUrlFormatString="WebForm2.aspx?RNum={0}" DataTextField="RNum" HeaderText="No" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" ReadOnly="true"/>
<asp:BoundField DataField="AssignTo" HeaderText="AssignTo" SortExpression="AssignTo" />
<asp:BoundField DataField="Priority" HeaderText="Priority" SortExpression="Priority" ReadOnly="true" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:BoundField DataField="UserName" HeaderText="Requested By" SortExpression="UserName" ReadOnly="true" />
<asp:BoundField DataField="ddate" HeaderText="Date" SortExpression="ddate" ReadOnly="true" />
</Columns>
答案 0 :(得分:0)
您必须修改基础SqlDataSource
Update
命令属性,如下例所示:
UpdateCommand="Update Employees SET FirstName=@FirstName,LastName=@LastName,Title=@Title WHERE EmployeeID=@EmployeeID"