Can't "Enable Editing" on my gridview - asp.net

I'm trying to connect my gridview to a LinqDataSource to select, update, insert and delete records. I am able to get into edit mode and cancel out of edit mode but when I click update nothing happens.
I've found a few things online that say to check the "Enable Editing" box in the gridview smart tag but when I go into the smart tag the only check boxes that appear are: Enable Paging, Enable Sorting and Enable selection. The others don't appear. Dose anyone see a problem with what I am doing below?
<asp:GridView ID="gv_Personnel"
runat="server"
OnRowDataBound="gv_Personnel_DataBind"
AutoGenerateColumns="False"
ShowFooter="True"
DataKeyNames="BudgetLineID"
AutoGenerateEditButton="True"
AutoGenerateDeleteButton="True"
DataSourceID="lds_Personnel"
>
<Columns>
<asp:BoundField HeaderText="Level of Staff" DataField="LineDescription" />
<asp:BoundField HeaderText="Hrs/Units requested" DataField="NumberOfUnits" />
<asp:BoundField HeaderText="Hrs/Units of Applicant Cost Share" DataField="" NullDisplayText="0" />
<asp:BoundField HeaderText="Hrs/Units of Partner Cost Share" DataField="" NullDisplayText="0" />
<asp:BoundField FooterStyle-Font-Bold="true"
FooterText="TOTAL PERSONNEL SERVICES:" HeaderText="Rate"
DataFormatString="{0:C}" DataField="UnitPrice" >
<FooterStyle Font-Bold="True" />
</asp:BoundField>
<asp:TemplateField HeaderText="Amount Requested"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Applicant Cost Share"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Partner Cost Share"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Total Projet Cost"
ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
FooterStyle-BorderWidth="2" FooterStyle-Font-Bold="true">
<FooterStyle BorderWidth="2px" Font-Bold="True" HorizontalAlign="Right" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="lds_Personnel" runat="server"
ContextTypeName="nrm.FRGPproposal.FrgpropDataContext"
Select="new (BudgetLineID, UnitPrice, LineDescription, NumberOfUnits)"
TableName="BudgetLines"
Where="ProposalID == #PropNumber && BudgetLineTypeCode == #BudgetLineTypeCode"
EnableDelete="True" EnableInsert="True" EnableUpdate="True">
<WhereParameters>
<asp:SessionParameter Name="PropNumber" SessionField="PropNumber" Type="Int32" />
<asp:Parameter DefaultValue="S" Name="BudgetLineTypeCode" Type="Char" />
</WhereParameters>
</asp:LinqDataSource>

Did you try it without using anonymous types? In code, you can't update anon. types in the database...

Looks like this was caused by me having the Select value set on my LinqDataSoruce. See updated LDS below:
<asp:LinqDataSource ID="lds_Personnel" runat="server"
ContextTypeName="nrm.FRGPproposal.FrgpropDataContext"
TableName="BudgetLines"
Where="ProposalID == #PropNumber && BudgetLineTypeCode == #BudgetLineTypeCode"
EnableDelete="True" EnableInsert="True" EnableUpdate="True">
<WhereParameters>
<asp:SessionParameter Name="PropNumber" SessionField="PropNumber" Type="Int32" />
<asp:Parameter DefaultValue="S" Name="BudgetLineTypeCode" Type="Char" />
</WhereParameters>
</asp:LinqDataSource>

Related

CheckBox Field does not show checked or not in gridview

i'm used checkbox field in gridview to show bit value from database on my gridview
i used default editing row on gridview , when i update row (checked checkbox field)
in database update successfully but in gridview does not show checked or not checked
when i refresh page not show again or when i rerun page same problem as a whole does not show checkbox field bit value status check box filed always is empty and not checkedthis is my gridview html codes
<asp:SqlDataSource ID="sqldsReplys" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>' UpdateCommand="MNG_Forum_Update_Reply_Status" UpdateCommandType="StoredProcedure" SelectCommand="MNG_Forum_Select_Replys" SelectCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="id" Type="Int64" />
<asp:Parameter Name="PostStatus" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:GridView ID="grdReplys" runat="server" CssClass="GridViewStyle" DataKeyNames="id" AutoGenerateColumns="False" AllowPaging="True" Width="100%" DataSourceID="sqldsReplys">
<Columns>
<asp:CommandField ShowSelectButton="True" ButtonType="Image" SelectImageUrl="~/cpanel/assets/img/sel.png">
</asp:CommandField>
<asp:BoundField DataField="id" HeaderText="ردیف" ReadOnly="true" />
<asp:BoundField DataField="Ptitle" HeaderText="عنوان مطلب" ReadOnly="true" />
<asp:CheckBoxField DataField="PostStatus" HeaderText="وضعیت نمایش" />
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="btnDelete" runat="server" CommandName="delete" ToolTip="حذف این رکورد"
OnClientClick="return confirm('آیا مطمئن هستید؟')" ImageUrl="~/cpanel/assets/img/Trash.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" EditText="ویرایش" UpdateText="تائید" CancelText="لغو" />
</Columns>
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>

Getting invalid character error when deleting a gridview row

I was assigned to convert some .Net projects in old version to to .net 4.0 version. I used ODAC driver replacing ODBC driver. Everything went fine until I found a problem with a gridview were I get illegal character Oracle exception when I try to delete a row. The gridview is inside an update panel. The exception I receive is Microsoft Jscript run time error:Sys.WebForms.PageRequestManagerServerErrorException: ORA-00911:invalid character. The following is the code for the grid view and the sqldatasource. The linkbutton triggers the delete using the deleteparameters of the sqldatasource.
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="View">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("CODE_OWNER_ID", "default.aspx?id={0}") %>'>View</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CODE_OWNER_ID" Visible ="False" HeaderText="CODE OWNER ID" />
<asp:BoundField DataField="CODE_TYPE" ReadOnly ="True" HeaderText="CODE TYPE" />
<asp:BoundField DataField="CODE" ReadOnly="True" HeaderText="CODE" />
<asp:BoundField DataField="UNIT_CODE" ReadOnly ="True" HeaderText="UNIT CODE" />
<asp:BoundField DataField="UNIT_NAME" ReadOnly="True" HeaderText="UNIT NAME" />
<asp:BoundField DataField="UNIT_DO" ReadOnly="True" HeaderText="UNIT DO" />
<asp:BoundField DataField="OWNER" ReadOnly="True" HeaderText="OWNER" />
<asp:BoundField DataField="OWNER_EMAIL" ReadOnly="True" HeaderText="OWNER EMAIL" />
<asp:BoundField DataField="OWNER_PHONE" ReadOnly="True" HeaderText="OWNER PHONE" />
<asp:BoundField DataField="OWNER_MAILPOINT" ReadOnly="True" HeaderText="OWNER MAILPOINT" />
<asp:BoundField DataField="CODE_ESTABLISHED_DATE" ReadOnly="True" DataFormatString="{0:MM/dd/yyyy}" HeaderText="CODE ESTABLISHED DATE" />
<asp:BoundField DataField="LAST_REVIEW_DATE" ReadOnly="True" DataFormatString="{0:MM/dd/yyyy}" HeaderText="LAST REVIEW DATE" />
<asp:BoundField DataField="REVIEW_USERNAME" ReadOnly="True" HeaderText="REVIEW USERNAME" />
<asp:BoundField DataField="CODE_DELETED_DATE" ReadOnly="True" DataFormatString="{0:MM/dd/yyyy}" HeaderText="CODE DELETED DATE" />
<asp:BoundField DataField="DELETE_REASON" ReadOnly="True" HeaderText="DELETE REASON" />
<asp:BoundField DataField="UPDATE_USERNAME" ReadOnly="True" HeaderText="UPDATE USERNAME" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
Text='Delete'
OnClientClick="return confirm('Are you sure you want to delete this record?');"
CommandArgument='<%# bind("CODE_OWNER_ID") %>'></asp:LinkButton>
</ItemTemplate>
<ItemStyle Wrap="False" />
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" ForeColor="Navy" Font-Bold="True" />
<HeaderStyle BackColor="#990000" Font-Bold="True" HorizontalAlign="Center" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnAdd" />
</Triggers>
</asp:UpdatePanel>
<asp:SqlDataSource ID="Sqldatasource1" runat="server" ConnectionString="<%$ ConnectionStrings:Conn_Code_Owner %>"
ProviderName="<%$ ConnectionStrings:Conn_Code_Owner.ProviderName %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM CODE_OWNER"
DeleteCommand="DELETE FROM CODE_OWNER WHERE CODE_OWNER_ID = ?"
OnSelecting="_data_Selecting"
ConflictDetection="CompareAllValues" >
<DeleteParameters>
<asp:Parameter Name="Original_CODE_OWNER_ID" Type="Decimal"/>
</DeleteParameters>
</asp:SqlDataSource>
Try and wrap it w/ a Begin and End
BEGIN CODE_OWNER WHERE CODE_OWNER_ID = ? END
http://www.lazyasscoder.com/Article.aspx?id=89&title=ora-00911%3A+invalid+character+when+executing+multiple+Oracle+SQL+statements
I found an easy alternative using row-deleting event of the grid-view. I Just removed the delete parameters in the sqldatasource of asp page and then I set conflict-detection to overwrite-changes.
Sqldatasource1.DeleteCommand = "DELETE FROM code_owner WHERE code_owner_ID = :original_code_owner_ID"
Sqldatasource1.DeleteParameters.Add("original_code_owner_ID", GridView1.DataKeys(e.RowIndex).Values("code_owner_ID").ToString)
Sqldatasource1.Delete()
GridView1.DataBind()

How to make a Gridview template field select the row of data?

I have a command field in a gridview, that as it is, works as it should. When i select it, the row is hilighted. However, i needed to convert this field into a template, so i could give it a ID that i could reference when using a AJAX Mobal control. I did this, and i am able to reference it with my Ajax control just fine, but, now this field does not select the row in the Gridview? The Select value is needed for the Ajax control to pull the data thru. So i think my issue is, How do i use this command field as a template, AND have it select the row? I hope i am explaining my issue correctly.
Here is the snippet of code when i convert it into a template.
Thank you!
<asp:GridView ID="GridView3" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="3" DataKeyNames="Contact_ID" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None" PageSize="6">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select" Text="Edit"></asp:LinkButton>
<asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="LinkButton1" PopupControlID="DetailsView1" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Contact_ID" HeaderText="Contact_ID" InsertVisible="False" ReadOnly="True" SortExpression="Contact_ID" Visible="False" />
<asp:BoundField DataField="Contact_Assigned_Username" HeaderText="Username" SortExpression="Contact_Assigned_Username" />
<asp:BoundField DataField="Contact_First_Name" HeaderText="First Name" SortExpression="Contact_First_Name" />
<asp:BoundField DataField="Contact_Last_Name" HeaderText="Last Name" SortExpression="Contact_Last_Name" />
<asp:BoundField DataField="Contact_Email_Address" HeaderText="Email Address" SortExpression="Contact_Email_Address" />
<asp:BoundField DataField="Contact_Cell_Phone" HeaderText="Cell Phone" SortExpression="Contact_Cell_Phone" />
<asp:CheckBoxField DataField="Contact_Administrator" HeaderText="Admin" SortExpression="Contact_Administrator" />
<asp:CheckBoxField DataField="Contact_LineStat_Triggers_Email" HeaderText="Email Triggers" SortExpression="Contact_LineStat_Triggers_Email" />
<asp:CheckBoxField DataField="Contact_LineStat_Triggers_Text" HeaderText="Text Triggers" SortExpression="Contact_LineStat_Triggers_Text" />
<asp:CheckBoxField DataField="Contact_Web_Portal" HeaderText="Web Access" SortExpression="Contact_Web_Portal" />
<asp:BoundField DataField="Contact_Customer_ID" HeaderText="Contact_Customer_ID" SortExpression="Contact_Customer_ID" Visible="False" />
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
In the RowDataBound event, try something like this:
protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
{
LinkButton btn = (LinkButton)e.Row.FindControl("LinkButton1");
btn.OnClientClick = Page.ClientScript.GetPostBackEventReference(GridView3, "Select$" + e.Row.RowIndex.ToString()));
}

Help with ASP.NET ObjectDataSource

I have a User object with a Load method that takes in a UserId parameter and loads that users data to the objects member variables.
Now what I'd like to do is load this data to a DetailsView control using an ObjectDataSource, but I'm stumped as to how.
First of all, I'm not sure I've got the code set up properly to pass the parameter (UserID) to the SelectMethod (cUser.Load). Secondly, I don't know how I can load this data to the DetailsView since I'm not actually returning the results from the Load method, I'm simply loading the object with the data...here's my code..
<asp:GridView runat="server" ID="gvUsers" DataKeyNames="UserID" BackColor="#eeeeee" Width="85%"
HorizontalAlign="Center"
Font-Bold="True" Font-Names="Verdana"
Font-Size="10pt" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound"
OnRowDeleting="GridView1_RowDeleting"
OnSelectedIndexChanged="IndexChanged" >
<HeaderStyle BackColor="Black" ForeColor="White"
Font-Bold="True" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="yellow" ForeColor="blue" />
<AlternatingRowStyle BackColor="#ffffff" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton2"
CommandArgument='<%# Eval("UserID") %>'
CommandName="Select" runat="server">
Select</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UserID" Visible="false" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:TemplateField HeaderText="Delete?">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1"
CommandArgument='<%# Eval("UserID") %>'
CommandName="Delete" runat="server">
Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView><br /><br />
<asp:DetailsView runat="server" ID="dvUser" DataSourceID="ObjectDataSource1" AutoGenerateRows="False" Width="85%"
HorizontalAlign="Center" DataKeyNames="UserID" >
<Fields>
<asp:BoundField DataField="UserID" Visible="false" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:BoundField DataField="UserName" HeaderText="User Name" />
<asp:BoundField DataField="Password" HeaderText="Password" />
<asp:BoundField DataField="Birthdate" HeaderText="Birthdate" />
<asp:BoundField DataField="Address" HeaderText="Address" />
<asp:BoundField DataField="Apt" HeaderText="Apt" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="Province" HeaderText="Province" />
<asp:BoundField DataField="PostalCode" HeaderText="PostalCode" />
<asp:BoundField DataField="PhoneNum" HeaderText="PhoneNum" />
<asp:BoundField DataField="Email" HeaderText="Email" />
<asp:BoundField DataField="ynAdminUser" HeaderText="ynAdminUser" />
<asp:CommandField ShowDeleteButton="False" ShowEditButton="True" ShowInsertButton="True" />
>
</Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1"
runat="server" SelectMethod="Load" TypeName="cUser">
<SelectParameters>
<asp:ControlParameter ControlID="gvUsers" PropertyName="SelectedValue" Name="iUserID" Type="int32" />
</SelectParameters>
</asp:ObjectDataSource>
is there a way to do what I'm trying to achieve? if so, can you please give examples with the explanation?
Very much appreciated. Thanks
you need to check this tutorial for detail help....
Master/Detail Using a Selectable Master GridView with a Details DetailView

Using a detailsview without sqldatasource

I have a Detailsview object that is loaded with user data when a User is clicked from a gridview. The problem is, I am using a sqldatasource and I'd rather use my pre-exisiting user class which has all the built in functionality for this. I haven't been able to get this done correctly. I can't get the detailsview populated with user data without the sqldatasource, and when I try inserting or updating with my objects, it runs through the insert/update code, then fails afterwards because I don't have a InsertCommand, etc for my SQLDataSource....bottom line...can somebody help me get this working without needing the SQLDataSource?
Here's my code.
<asp:GridView runat="server" ID="gvUsers" DataKeyNames="UserID" BackColor="#eeeeee" Width="85%"
HorizontalAlign="Center"
Font-Bold="True" Font-Names="Verdana"
Font-Size="10pt" AutoGenerateColumns="False"
OnRowDataBound="GridView1_RowDataBound"
OnRowDeleting="GridView1_RowDeleting" >
<HeaderStyle BackColor="Black" ForeColor="White"
Font-Bold="True" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="yellow" ForeColor="blue" />
<AlternatingRowStyle BackColor="#ffffff" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton2"
CommandArgument='<%# Eval("UserID") %>'
CommandName="Select" runat="server">
Select</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="UserID" Visible="false" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:TemplateField HeaderText="Delete?">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1"
CommandArgument='<%# Eval("UserID") %>'
CommandName="Delete" runat="server">
Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView><br /><br />
<asp:DetailsView runat="server" ID="dvUser" DataSourceID="SqlDataSource3" AutoGenerateRows="False" Width="85%"
HorizontalAlign="Center" DataKeyNames="UserID">
<Fields>
<asp:BoundField DataField="UserID" Visible="false" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:BoundField DataField="UserName" HeaderText="User Name" />
<asp:BoundField DataField="Password" HeaderText="Password" />
<asp:BoundField DataField="Birthdate" HeaderText="Birthdate" />
<asp:BoundField DataField="Address" HeaderText="Address" />
<asp:BoundField DataField="Apt" HeaderText="Apt" />
<asp:BoundField DataField="City" HeaderText="City" />
<asp:BoundField DataField="Province" HeaderText="Province" />
<asp:BoundField DataField="PostalCode" HeaderText="PostalCode" />
<asp:BoundField DataField="PhoneNum" HeaderText="PhoneNum" />
<asp:BoundField DataField="Email" HeaderText="Email" />
<asp:BoundField DataField="ynAdminUser" HeaderText="ynAdminUser" />
<asp:CommandField ShowDeleteButton="False" ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:ConnectionString%>" ID="SqlDataSource3"
runat="server" SelectCommand="sp_GetUser" SelectCommandType="StoredProcedure" OnInserting="OnInserting" >
<SelectParameters>
<asp:ControlParameter ControlID="gvUsers" Name="UserID" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
Not sure the CodeBehind is necessary, I just want to use that to call my data object code for updating, insert etc
Why not use a ObjectDataSource. This control works much like an SqlDataSource but instead of specifying an SQL query or Stored Procedure you specify the methods of your custom business object to perform your data access.
<asp:ObjectDataSource ID="ObjectDataSource" Drunat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="Select" UpdateMethod="Update" TypeName="YourType">
Here's an example illustrating how to use an ObjectDataSource with a DetailsView.

Resources