I have a Gridview connected to a SqlDataSource. The problem is that my UpdateCommand is not working after pressing the edit link, and then update link. I have AutoGenerateEdi tButton="True" set and DataKeyNames set to the primary key of my table. The code follows: The funny thing is that if I say ="Update vehicles SET manufacturer_id =?,model_id=?,a sking_price=? WHERE vehicle_id=3", thus manually setting the vehicle_id=3 or for whatever row, it updates. But if I say vehicle_id=? in UpdateCommand nothing happens. No errors either. My AutoGenerateDel eteButton works 100% but no Edit
Any help would be appreciated
Thanks
Code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="vehicle_id"
DataSourceID="SqlDataSource1" AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" >
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="vehicle_id" HeaderText="vehicle_id" InsertVisible="False"
ReadOnly="True" SortExpression="vehicle_id" />
<asp:BoundField DataField="manufacturer_id" HeaderText="manufacturer_id" SortExpression="manufacturer_id" />
<asp:BoundField DataField="model_id" HeaderText="model_id" SortExpression="model_id" />
<asp:BoundField DataField="vehicle_cat_id" HeaderText="vehicle_cat_id" SortExpression="vehicle_cat_id" />
<asp:BoundField DataField="asking_price" HeaderText="asking_price" SortExpression="asking_price" />
<asp:BoundField DataField="current_mileage" HeaderText="current_mileage" SortExpression="current_mileage" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="dsn=FSW"
ProviderName="System.Data.Odbc" SelectCommand="SELECT * FROM [vehicles]"
UpdateCommand="Update vehicles SET manufacturer_id=?,model_id=?,asking_price=? WHERE vehicle_id=?"
DeleteCommand="Delete from vehicles where vehicle_id=?"
OnUpdated="OnDSUpdatedHandler"></asp:SqlDataSource>
Thanks