Posted By

pluggy13 on 08/20/08


Tagged


Versions (?)

Detailsview with Binary data


 / Published in: ASP
 

  1. Here's the source code of the detailsview and objectdatasource:
  2.  
  3. <asp:ObjectDataSource ID="CustomerDetailDataSource" runat="server"
  4. DataObjectTypeName="Customer" DeleteMethod="Delete"
  5. SelectMethod="GetCustomerByID" TypeName="CustomerManager"
  6. UpdateMethod="UpdateCustomer">
  7. <SelectParameters>
  8. <asp:Parameter DefaultValue="0" Name="ID" Type="Int32" />
  9. </SelectParameters>
  10. </asp:ObjectDataSource>
  11.  
  12. <asp:DetailsView ID="DetailsView1" runat="server"
  13. AutoGenerateRows="False" DataSourceID="CustomerDetailDataSource"
  14. DefaultMode="Edit">
  15. <Fields>
  16. <asp:BoundField DataField="fname" HeaderText="fname"
  17. SortExpression="fname" />
  18. <asp:BoundField DataField="lname" HeaderText="lname"
  19. SortExpression="lname" />
  20. <asp:BoundField DataField="email" HeaderText="email"
  21. SortExpression="email" />
  22. <asp:BoundField DataField="ID" HeaderText="ID"
  23. SortExpression="ID" ReadOnly="true"/>
  24. <!--
  25. WITHOUT THE NEXT LINE, VERSION IS NULL WHEN UPDATING THE
  26. ENTITY, WITH THE NEXT LINE I GET AN EXCEPTION WHEN UPDATING
  27. -->
  28. <asp:BoundField DataField="version" HeaderText="version"
  29. SortExpression="version" ReadOnly="true"/>
  30. </Fields>
  31. </asp:DetailsView>
  32.  
  33. This is what I call in my updatebutton's event handler:
  34.  
  35. DetailsView1.UpdateItem(true);

Report this snippet  

You need to login to post a comment.