Hi I am having trouble getting the ASP.Net grid to save to the database using the SQLDataSource, the SELECT is OK but the INSERT, DELETE and UPDATE don't update the database (the grid looks like you have changed the data but the database does not reflect changes). Can you spot where I have gone wrong please?
<ej:Grid ID="Grid1" runat="server" DataSourceCachingMode="None" DataSourceID="SqlDataSource1" MinWidth="0" AllowFiltering="True" AllowSorting="True" >
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
<ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
<Columns>
<ej:Column AllowEditing="False" DataType="number" Field="ProductID" IsIdentity="True" Visible="False">
</ej:Column>
<ej:Column DataType="string" Field="ProductName">
</ej:Column>
<ej:Column DataType="string" Field="ProductDescription">
</ej:Column>
<ej:Column DataType="string" Field="ProductImageName">
</ej:Column>
<ej:Column DataType="string" Field="ProductCategory">
</ej:Column>
<ej:Column DataType="date" Field="ProductDateAdded">
</ej:Column>
<ej:Column DataType="number" Field="ProductPrice">
</ej:Column>
</Columns>
<PageSettings Template=""></PageSettings>
<RowDropSettings DropTargetID="" DropMapper=""></RowDropSettings>
<ScrollSettings EnableTouchScroll="False"></ScrollSettings>
</ej:Grid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"
SelectCommand="SELECT ProductID, ProductName, ProductDescription, ProductImageName, ProductCategory, ProductDateAdded, ProductPrice FROM tblProducts"
UpdateCommand="UPDATE tblProducts SET ProductName = @ProductName, ProductDescription = @ProductDescription, ProductImageName = @ProductImageName, ProductCategory = @ProductCategory, ProductDateAdded = @ProductDateAdded, ProductPrice = @ProductPrice WHERE (ProductID = @ProductID)"
DeleteCommand="DELETE FROM tblProducts WHERE (ProductID = @ProductID)"
InsertCommand="INSERT INTO tblProducts SELECT @ProductName AS Expr1, @ProductDescription AS Expr2, @ProductImageName AS Expr3, @ProductCategory AS Expr4, @ProductDateAdded AS Expr5, @ProductPrice AS Expr6">
<DeleteParameters>
<asp:Parameter Name="ProductID" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="ProductName" />
<asp:Parameter Name="ProductDescription" />
<asp:Parameter Name="ProductImageName" />
<asp:Parameter Name="ProductCategory" />
<asp:Parameter Name="ProductDateAdded" />
<asp:Parameter Name="ProductPrice" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" />
<asp:Parameter Name="ProductDescription" />
<asp:Parameter Name="ProductImageName" />
<asp:Parameter Name="ProductCategory" />
<asp:Parameter Name="ProductDateAdded" />
<asp:Parameter Name="ProductPrice" />
<asp:Parameter Name="ProductID" />
</UpdateParameters>
</asp:SqlDataSource>