I have a gridview that shows the content of a view in the database. The database view does group by on AppName in an underlying table and the view always shows count and average and (for the remaining columns) the latest added row in the underlying table.
In the gridview on webpage we only need to be able to update the latest added row in the database table. Plus we also need to be able to add new rows for one AppName at a time.
Thus we would like to have the following design of the Gridview in the webpage. (first row show in edit mode)
Update: should do a normal update to the shown row. We have an update stored procedure which does that in the underlying datatable
Add: should insert a new row in the underlying datatable. We have a insert stored procedure to insert the new values in the underlying datatable.
Note: 3 first columns in Gridview is read only.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:RoozzTestLogConnectionString %>"
DeleteCommand="TestLogDelete" DeleteCommandType="StoredProcedure"
InsertCommand="TestLogInsert" InsertCommandType="StoredProcedure"
SelectCommand="SELECT * FROM [EntryView]" UpdateCommand="TestLogUpdate"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="OSID" Type="Int32" />
<asp:Parameter Name="BrowserID" Type="Int32" />
<asp:Parameter Name="FWID" Type="Int32" />
<asp:Parameter Name="AdminRights" Type="Boolean" />
<asp:Parameter Name="TestUser" Type="String" />
<asp:Parameter Name="Quality" Type="Int32" />
<asp:Parameter Name="Message" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="AppID" Type="Int32" />
<asp:Parameter Name="OSID" Type="Int32" />
<asp:Parameter Name="BrowserID" Type="Int32" />
<asp:Parameter Name="FWID" Type="Int32" />
<asp:Parameter Name="AdminRights" Type="Boolean" />
<asp:Parameter Name="TestUser" Type="String" />
<asp:Parameter Name="Quality" Type="Int32" />
<asp:Parameter Name="Message" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
My problem is that Gridview does not work correctly in Edit mode.
- It does not bind correctly to dropdownlist values
- It does not run the update stored procedure and nor does it give an error message.
- Id does not run the insert stored procedure and nor does it give an error message.
Can anyone point to an example that will help me fix these problems?