I drop a
DetailsView according to the instructions.
At Step 5 I set the
DefaultMode as instructed, however, I notice the code doesn't setup the asp:BoundFields as in the example in the book. It looks like this after the Behavior property is set:
Code:
<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1"
DefaultMode="Insert" Height="50px" Width="125px">
<Fields>
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
Obviously, when the page is run the
Id column of the sql table is insertable, which we don't want.
This isn't a big deal as I get how to fix it, I was just wondering what, if anything, I could be doing wrong here. The instructions seem clear enough and I've tried them twice.
I wouldn't mind having the opportunity to be lazy by not having to write the additional lines to configure the asp:BoundFields manually in cases where larger amounts of data are at play.
I also notice that the "AutoGenerateRows=False" and the "DataKeyNames=Id" properties aren't set in my code vs the code example in the book...maybe I have to set these manually every time? The books seems to suggest these properties will be autoset after pointing the control to the SqlDataSource control.
Thanks for your help.