DetailsView and template fields

Discussion in 'ASP .Net' started by studio60podcast@gmail.com, Aug 7, 2006.

  1. Guest

    I have a gridview and a details view in a page. The two are hooked up,
    so that when a row is selected in the GridView, the DetailsView
    displays the details. But, what I'm trying to accomplish is this:

    I have two tables - user and item.
    user table:
    user_id int
    user_name varchar(50)

    item table:
    item_id int
    user_id int (foreign key from user table)
    item_name varchar(50)

    The item table contains inventory items and it has a foreign key from
    the user table indicating which user posseses that inventory. However,
    when editing this item, if I need to change the user to whom it is
    assigned, I want to display the user's name rather than the users id
    from the item table in a DropDownList in the DetailsView. So what I
    have done to accomplish this is create a TemplateField that holds a
    DropDownList and an ObjectDataSource that populates the DDL with all of
    the possible users. And in the DataBound event, I select the user's
    name in the DDL to whom the item is currently assigned. But I don't
    know how to capture the selected user'd id and pass it to the Update
    method in the ObjectDataSource for the DetailsView. I hope this has
    been clear...

    Here is some code:
    <asp:DetailsView ID="dvEditItem" runat="server" Height="50px"
    GridLines="None" AutoGenerateRows="False" DataKeyNames="inv_item_id"
    DataSourceID="odsInventoryItem" DefaultMode="Edit"
    OnItemUpdated="dvEditItem_ItemUpdated" >
    <Fields>
    <asp:TemplateField HeaderText="User"
    SortExpression="inv_person_id">
    <EditItemTemplate>
    <asp:DropDownList ID="ddlPerson" runat="server"
    CssClass="textGrey10" DataSourceID="odsInventoryPerson"
    DataTextField="corp_person_fullname"
    DataValueField="corp_person_id" Width="244px"
    OnDataBound="ddlPerson_DataBound">
    </asp:DropDownList>
    <asp:ObjectDataSource ID="odsInventoryPerson" runat="server"
    OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetUndeletedPeople"
    TypeName="dsPersonTableAdapters.tbcorp_personTableAdapter">
    </asp:ObjectDataSource>
    </EditItemTemplate>
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:TemplateField>
    <asp:BoundField DataField="inv_item_description"
    HeaderText="Description" SortExpression="inv_item_description">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_serial" HeaderText="Serial
    Number" SortExpression="inv_item_serial">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_workauthorization"
    HeaderText="Work Authorization"
    SortExpression="inv_item_workauthorization">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_purchasecost"
    HeaderText="Purchase Cost" SortExpression="inv_item_purchasecost">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_podate" HeaderText="PO Date"
    SortExpression="inv_item_podate">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_warrantyexpiration"
    HeaderText="Warranty Expires"
    SortExpression="inv_item_warrantyexpiration">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_invoicenumber"
    HeaderText="Invoice Number" SortExpression="inv_item_invoicenumber">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:BoundField DataField="inv_item_invoicedate"
    HeaderText="Invoice Date" SortExpression="inv_item_invoicedate">
    <ControlStyle CssClass="detailsViewControlSmall" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:BoundField>
    <asp:CheckBoxField DataField="inv_item_active"
    HeaderText="Active" SortExpression="inv_item_active">
    <ItemStyle HorizontalAlign="Left" Width="50px" />
    <HeaderStyle CssClass="detailsViewHeaderText" />
    </asp:CheckBoxField>
    <asp:CommandField ButtonType="Button" ShowCancelButton="False"
    ShowEditButton="True">
    <ControlStyle CssClass="textGrey10" />
    </asp:CommandField>
    </Fields>
    </asp:DetailsView>
    <asp:ObjectDataSource ID="odsInventoryItem" runat="server"
    OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetInventoryItemByID"
    TypeName="dsItemTableAdapters.tbinv_itemTableAdapter"
    UpdateMethod="UpdateItemByID" >
    <UpdateParameters>
    <asp:parameter Name="corp_person_id" Type="Int32" />
    <asp:parameter Name="inv_item_description" Type="String" />
    <asp:parameter Name="inv_item_serial" Type="String" />
    <asp:parameter Name="inv_item_workauthorization" Type="String"
    />
    <asp:parameter Name="inv_item_purchasecost" Type="Single" />
    <asp:parameter Name="inv_item_podate" Type="DateTime" />
    <asp:parameter Name="inv_item_active" Type="Boolean" />
    <asp:parameter Name="inv_item_warrantyexpiration"
    Type="DateTime" />
    <asp:parameter Name="inv_item_invoicenumber" Type="String" />
    <asp:parameter Name="inv_item_invoicedate" Type="DateTime" />
    <asp:parameter Name="Original_inv_item_id" Type="Int32" />
    </UpdateParameters>
    <SelectParameters>
    <asp:ControlParameter ControlID="gvItemList" Name="inv_item_id"
    PropertyName="SelectedValue"
    Type="Int32" />
    </SelectParameters>
    </asp:ObjectDataSource>
    , Aug 7, 2006
    #1
    1. Advertising

  2. CK Guest

    You need to specifiy the update method that will be used in your datasource
    and you need some Control Update parameters. It would look something like
    this.

    <UpdateParameters>


    <asp:ControlParameter ControlID="ddlPerson" PropertyName="SelectedValue"
    Name="PersonID" />

    </UpdateParameters>

    Alternatively you could set the control parameter when you need it.
    Something like this

    ObjectDataSoure.UpdateParameters[0].value =
    ((DropDownList)dvEditItem.FindControl('ddlPerson')).SelectedValue;

    ObjectDataSource.Update();

    Something like that should work for you. HTH.

    ~CK



    <> wrote in message
    news:...
    >I have a gridview and a details view in a page. The two are hooked up,
    > so that when a row is selected in the GridView, the DetailsView
    > displays the details. But, what I'm trying to accomplish is this:
    >
    > I have two tables - user and item.
    > user table:
    > user_id int
    > user_name varchar(50)
    >
    > item table:
    > item_id int
    > user_id int (foreign key from user table)
    > item_name varchar(50)
    >
    > The item table contains inventory items and it has a foreign key from
    > the user table indicating which user posseses that inventory. However,
    > when editing this item, if I need to change the user to whom it is
    > assigned, I want to display the user's name rather than the users id
    > from the item table in a DropDownList in the DetailsView. So what I
    > have done to accomplish this is create a TemplateField that holds a
    > DropDownList and an ObjectDataSource that populates the DDL with all of
    > the possible users. And in the DataBound event, I select the user's
    > name in the DDL to whom the item is currently assigned. But I don't
    > know how to capture the selected user'd id and pass it to the Update
    > method in the ObjectDataSource for the DetailsView. I hope this has
    > been clear...
    >
    > Here is some code:
    > <asp:DetailsView ID="dvEditItem" runat="server" Height="50px"
    > GridLines="None" AutoGenerateRows="False" DataKeyNames="inv_item_id"
    > DataSourceID="odsInventoryItem" DefaultMode="Edit"
    > OnItemUpdated="dvEditItem_ItemUpdated" >
    > <Fields>
    > <asp:TemplateField HeaderText="User"
    > SortExpression="inv_person_id">
    > <EditItemTemplate>
    > <asp:DropDownList ID="ddlPerson" runat="server"
    > CssClass="textGrey10" DataSourceID="odsInventoryPerson"
    > DataTextField="corp_person_fullname"
    > DataValueField="corp_person_id" Width="244px"
    > OnDataBound="ddlPerson_DataBound">
    > </asp:DropDownList>
    > <asp:ObjectDataSource ID="odsInventoryPerson" runat="server"
    > OldValuesParameterFormatString="original_{0}"
    > SelectMethod="GetUndeletedPeople"
    > TypeName="dsPersonTableAdapters.tbcorp_personTableAdapter">
    > </asp:ObjectDataSource>
    > </EditItemTemplate>
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:TemplateField>
    > <asp:BoundField DataField="inv_item_description"
    > HeaderText="Description" SortExpression="inv_item_description">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_serial" HeaderText="Serial
    > Number" SortExpression="inv_item_serial">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_workauthorization"
    > HeaderText="Work Authorization"
    > SortExpression="inv_item_workauthorization">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_purchasecost"
    > HeaderText="Purchase Cost" SortExpression="inv_item_purchasecost">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_podate" HeaderText="PO Date"
    > SortExpression="inv_item_podate">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_warrantyexpiration"
    > HeaderText="Warranty Expires"
    > SortExpression="inv_item_warrantyexpiration">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_invoicenumber"
    > HeaderText="Invoice Number" SortExpression="inv_item_invoicenumber">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:BoundField DataField="inv_item_invoicedate"
    > HeaderText="Invoice Date" SortExpression="inv_item_invoicedate">
    > <ControlStyle CssClass="detailsViewControlSmall" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:BoundField>
    > <asp:CheckBoxField DataField="inv_item_active"
    > HeaderText="Active" SortExpression="inv_item_active">
    > <ItemStyle HorizontalAlign="Left" Width="50px" />
    > <HeaderStyle CssClass="detailsViewHeaderText" />
    > </asp:CheckBoxField>
    > <asp:CommandField ButtonType="Button" ShowCancelButton="False"
    > ShowEditButton="True">
    > <ControlStyle CssClass="textGrey10" />
    > </asp:CommandField>
    > </Fields>
    > </asp:DetailsView>
    > <asp:ObjectDataSource ID="odsInventoryItem" runat="server"
    > OldValuesParameterFormatString="original_{0}"
    > SelectMethod="GetInventoryItemByID"
    > TypeName="dsItemTableAdapters.tbinv_itemTableAdapter"
    > UpdateMethod="UpdateItemByID" >
    > <UpdateParameters>
    > <asp:parameter Name="corp_person_id" Type="Int32" />
    > <asp:parameter Name="inv_item_description" Type="String" />
    > <asp:parameter Name="inv_item_serial" Type="String" />
    > <asp:parameter Name="inv_item_workauthorization" Type="String"
    > />
    > <asp:parameter Name="inv_item_purchasecost" Type="Single" />
    > <asp:parameter Name="inv_item_podate" Type="DateTime" />
    > <asp:parameter Name="inv_item_active" Type="Boolean" />
    > <asp:parameter Name="inv_item_warrantyexpiration"
    > Type="DateTime" />
    > <asp:parameter Name="inv_item_invoicenumber" Type="String" />
    > <asp:parameter Name="inv_item_invoicedate" Type="DateTime" />
    > <asp:parameter Name="Original_inv_item_id" Type="Int32" />
    > </UpdateParameters>
    > <SelectParameters>
    > <asp:ControlParameter ControlID="gvItemList" Name="inv_item_id"
    > PropertyName="SelectedValue"
    > Type="Int32" />
    > </SelectParameters>
    > </asp:ObjectDataSource>
    >
    CK, Aug 7, 2006
    #2
    1. Advertising

  3. Guest

    Thank you for the help. I didn't know how to access the Parameters
    collection.

    Some feedback though:
    1. I do have an Update Method specified in the ObjectDataSource
    definition. It's UpdateItemByID.
    2. If I use your first suggesstion, I get an error stating that it
    cannot find Control 'ddlPerson' in ControlParameter 'PersonID'
    3. If I use your second suggestion, I don't find a "Value" property in
    the UpdateParameters collection of the ObjectDataSource. I find
    DefaultValue, but not Value.

    Thanks!

    CK wrote:
    > You need to specifiy the update method that will be used in your datasource
    > and you need some Control Update parameters. It would look something like
    > this.
    >
    > <UpdateParameters>
    >
    >
    > <asp:ControlParameter ControlID="ddlPerson" PropertyName="SelectedValue"
    > Name="PersonID" />
    >
    > </UpdateParameters>
    >
    > Alternatively you could set the control parameter when you need it.
    > Something like this
    >
    > ObjectDataSoure.UpdateParameters[0].value =
    > ((DropDownList)dvEditItem.FindControl('ddlPerson')).SelectedValue;
    >
    > ObjectDataSource.Update();
    >
    > Something like that should work for you. HTH.
    >
    > ~CK
    >
    >
    >
    > <> wrote in message
    > news:...
    > >I have a gridview and a details view in a page. The two are hooked up,
    > > so that when a row is selected in the GridView, the DetailsView
    > > displays the details. But, what I'm trying to accomplish is this:
    > >
    > > I have two tables - user and item.
    > > user table:
    > > user_id int
    > > user_name varchar(50)
    > >
    > > item table:
    > > item_id int
    > > user_id int (foreign key from user table)
    > > item_name varchar(50)
    > >
    > > The item table contains inventory items and it has a foreign key from
    > > the user table indicating which user posseses that inventory. However,
    > > when editing this item, if I need to change the user to whom it is
    > > assigned, I want to display the user's name rather than the users id
    > > from the item table in a DropDownList in the DetailsView. So what I
    > > have done to accomplish this is create a TemplateField that holds a
    > > DropDownList and an ObjectDataSource that populates the DDL with all of
    > > the possible users. And in the DataBound event, I select the user's
    > > name in the DDL to whom the item is currently assigned. But I don't
    > > know how to capture the selected user'd id and pass it to the Update
    > > method in the ObjectDataSource for the DetailsView. I hope this has
    > > been clear...
    > >
    > > Here is some code:
    > > <asp:DetailsView ID="dvEditItem" runat="server" Height="50px"
    > > GridLines="None" AutoGenerateRows="False" DataKeyNames="inv_item_id"
    > > DataSourceID="odsInventoryItem" DefaultMode="Edit"
    > > OnItemUpdated="dvEditItem_ItemUpdated" >
    > > <Fields>
    > > <asp:TemplateField HeaderText="User"
    > > SortExpression="inv_person_id">
    > > <EditItemTemplate>
    > > <asp:DropDownList ID="ddlPerson" runat="server"
    > > CssClass="textGrey10" DataSourceID="odsInventoryPerson"
    > > DataTextField="corp_person_fullname"
    > > DataValueField="corp_person_id" Width="244px"
    > > OnDataBound="ddlPerson_DataBound">
    > > </asp:DropDownList>
    > > <asp:ObjectDataSource ID="odsInventoryPerson" runat="server"
    > > OldValuesParameterFormatString="original_{0}"
    > > SelectMethod="GetUndeletedPeople"
    > > TypeName="dsPersonTableAdapters.tbcorp_personTableAdapter">
    > > </asp:ObjectDataSource>
    > > </EditItemTemplate>
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:TemplateField>
    > > <asp:BoundField DataField="inv_item_description"
    > > HeaderText="Description" SortExpression="inv_item_description">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_serial" HeaderText="Serial
    > > Number" SortExpression="inv_item_serial">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_workauthorization"
    > > HeaderText="Work Authorization"
    > > SortExpression="inv_item_workauthorization">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_purchasecost"
    > > HeaderText="Purchase Cost" SortExpression="inv_item_purchasecost">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_podate" HeaderText="PO Date"
    > > SortExpression="inv_item_podate">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_warrantyexpiration"
    > > HeaderText="Warranty Expires"
    > > SortExpression="inv_item_warrantyexpiration">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_invoicenumber"
    > > HeaderText="Invoice Number" SortExpression="inv_item_invoicenumber">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:BoundField DataField="inv_item_invoicedate"
    > > HeaderText="Invoice Date" SortExpression="inv_item_invoicedate">
    > > <ControlStyle CssClass="detailsViewControlSmall" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:BoundField>
    > > <asp:CheckBoxField DataField="inv_item_active"
    > > HeaderText="Active" SortExpression="inv_item_active">
    > > <ItemStyle HorizontalAlign="Left" Width="50px" />
    > > <HeaderStyle CssClass="detailsViewHeaderText" />
    > > </asp:CheckBoxField>
    > > <asp:CommandField ButtonType="Button" ShowCancelButton="False"
    > > ShowEditButton="True">
    > > <ControlStyle CssClass="textGrey10" />
    > > </asp:CommandField>
    > > </Fields>
    > > </asp:DetailsView>
    > > <asp:ObjectDataSource ID="odsInventoryItem" runat="server"
    > > OldValuesParameterFormatString="original_{0}"
    > > SelectMethod="GetInventoryItemByID"
    > > TypeName="dsItemTableAdapters.tbinv_itemTableAdapter"
    > > UpdateMethod="UpdateItemByID" >
    > > <UpdateParameters>
    > > <asp:parameter Name="corp_person_id" Type="Int32" />
    > > <asp:parameter Name="inv_item_description" Type="String" />
    > > <asp:parameter Name="inv_item_serial" Type="String" />
    > > <asp:parameter Name="inv_item_workauthorization" Type="String"
    > > />
    > > <asp:parameter Name="inv_item_purchasecost" Type="Single" />
    > > <asp:parameter Name="inv_item_podate" Type="DateTime" />
    > > <asp:parameter Name="inv_item_active" Type="Boolean" />
    > > <asp:parameter Name="inv_item_warrantyexpiration"
    > > Type="DateTime" />
    > > <asp:parameter Name="inv_item_invoicenumber" Type="String" />
    > > <asp:parameter Name="inv_item_invoicedate" Type="DateTime" />
    > > <asp:parameter Name="Original_inv_item_id" Type="Int32" />
    > > </UpdateParameters>
    > > <SelectParameters>
    > > <asp:ControlParameter ControlID="gvItemList" Name="inv_item_id"
    > > PropertyName="SelectedValue"
    > > Type="Int32" />
    > > </SelectParameters>
    > > </asp:ObjectDataSource>
    > >
    , Aug 7, 2006
    #3
  4. CK Guest

    Assigning the default value to the desired value at run time should work. I
    apologize I was answering that off the top of my head.

    <> wrote in message
    news:...
    > Thank you for the help. I didn't know how to access the Parameters
    > collection.
    >
    > Some feedback though:
    > 1. I do have an Update Method specified in the ObjectDataSource
    > definition. It's UpdateItemByID.
    > 2. If I use your first suggesstion, I get an error stating that it
    > cannot find Control 'ddlPerson' in ControlParameter 'PersonID'
    > 3. If I use your second suggestion, I don't find a "Value" property in
    > the UpdateParameters collection of the ObjectDataSource. I find
    > DefaultValue, but not Value.
    >
    > Thanks!
    >
    > CK wrote:
    >> You need to specifiy the update method that will be used in your
    >> datasource
    >> and you need some Control Update parameters. It would look something like
    >> this.
    >>
    >> <UpdateParameters>
    >>
    >>
    >> <asp:ControlParameter ControlID="ddlPerson" PropertyName="SelectedValue"
    >> Name="PersonID" />
    >>
    >> </UpdateParameters>
    >>
    >> Alternatively you could set the control parameter when you need it.
    >> Something like this
    >>
    >> ObjectDataSoure.UpdateParameters[0].value =
    >> ((DropDownList)dvEditItem.FindControl('ddlPerson')).SelectedValue;
    >>
    >> ObjectDataSource.Update();
    >>
    >> Something like that should work for you. HTH.
    >>
    >> ~CK
    >>
    >>
    >>
    >> <> wrote in message
    >> news:...
    >> >I have a gridview and a details view in a page. The two are hooked up,
    >> > so that when a row is selected in the GridView, the DetailsView
    >> > displays the details. But, what I'm trying to accomplish is this:
    >> >
    >> > I have two tables - user and item.
    >> > user table:
    >> > user_id int
    >> > user_name varchar(50)
    >> >
    >> > item table:
    >> > item_id int
    >> > user_id int (foreign key from user table)
    >> > item_name varchar(50)
    >> >
    >> > The item table contains inventory items and it has a foreign key from
    >> > the user table indicating which user posseses that inventory. However,
    >> > when editing this item, if I need to change the user to whom it is
    >> > assigned, I want to display the user's name rather than the users id
    >> > from the item table in a DropDownList in the DetailsView. So what I
    >> > have done to accomplish this is create a TemplateField that holds a
    >> > DropDownList and an ObjectDataSource that populates the DDL with all of
    >> > the possible users. And in the DataBound event, I select the user's
    >> > name in the DDL to whom the item is currently assigned. But I don't
    >> > know how to capture the selected user'd id and pass it to the Update
    >> > method in the ObjectDataSource for the DetailsView. I hope this has
    >> > been clear...
    >> >
    >> > Here is some code:
    >> > <asp:DetailsView ID="dvEditItem" runat="server" Height="50px"
    >> > GridLines="None" AutoGenerateRows="False" DataKeyNames="inv_item_id"
    >> > DataSourceID="odsInventoryItem" DefaultMode="Edit"
    >> > OnItemUpdated="dvEditItem_ItemUpdated" >
    >> > <Fields>
    >> > <asp:TemplateField HeaderText="User"
    >> > SortExpression="inv_person_id">
    >> > <EditItemTemplate>
    >> > <asp:DropDownList ID="ddlPerson" runat="server"
    >> > CssClass="textGrey10" DataSourceID="odsInventoryPerson"
    >> > DataTextField="corp_person_fullname"
    >> > DataValueField="corp_person_id" Width="244px"
    >> > OnDataBound="ddlPerson_DataBound">
    >> > </asp:DropDownList>
    >> > <asp:ObjectDataSource ID="odsInventoryPerson" runat="server"
    >> > OldValuesParameterFormatString="original_{0}"
    >> > SelectMethod="GetUndeletedPeople"
    >> > TypeName="dsPersonTableAdapters.tbcorp_personTableAdapter">
    >> > </asp:ObjectDataSource>
    >> > </EditItemTemplate>
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:TemplateField>
    >> > <asp:BoundField DataField="inv_item_description"
    >> > HeaderText="Description" SortExpression="inv_item_description">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_serial" HeaderText="Serial
    >> > Number" SortExpression="inv_item_serial">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_workauthorization"
    >> > HeaderText="Work Authorization"
    >> > SortExpression="inv_item_workauthorization">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_purchasecost"
    >> > HeaderText="Purchase Cost" SortExpression="inv_item_purchasecost">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_podate" HeaderText="PO Date"
    >> > SortExpression="inv_item_podate">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_warrantyexpiration"
    >> > HeaderText="Warranty Expires"
    >> > SortExpression="inv_item_warrantyexpiration">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_invoicenumber"
    >> > HeaderText="Invoice Number" SortExpression="inv_item_invoicenumber">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:BoundField DataField="inv_item_invoicedate"
    >> > HeaderText="Invoice Date" SortExpression="inv_item_invoicedate">
    >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:BoundField>
    >> > <asp:CheckBoxField DataField="inv_item_active"
    >> > HeaderText="Active" SortExpression="inv_item_active">
    >> > <ItemStyle HorizontalAlign="Left" Width="50px" />
    >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> > </asp:CheckBoxField>
    >> > <asp:CommandField ButtonType="Button" ShowCancelButton="False"
    >> > ShowEditButton="True">
    >> > <ControlStyle CssClass="textGrey10" />
    >> > </asp:CommandField>
    >> > </Fields>
    >> > </asp:DetailsView>
    >> > <asp:ObjectDataSource ID="odsInventoryItem" runat="server"
    >> > OldValuesParameterFormatString="original_{0}"
    >> > SelectMethod="GetInventoryItemByID"
    >> > TypeName="dsItemTableAdapters.tbinv_itemTableAdapter"
    >> > UpdateMethod="UpdateItemByID" >
    >> > <UpdateParameters>
    >> > <asp:parameter Name="corp_person_id" Type="Int32" />
    >> > <asp:parameter Name="inv_item_description" Type="String" />
    >> > <asp:parameter Name="inv_item_serial" Type="String" />
    >> > <asp:parameter Name="inv_item_workauthorization" Type="String"
    >> > />
    >> > <asp:parameter Name="inv_item_purchasecost" Type="Single" />
    >> > <asp:parameter Name="inv_item_podate" Type="DateTime" />
    >> > <asp:parameter Name="inv_item_active" Type="Boolean" />
    >> > <asp:parameter Name="inv_item_warrantyexpiration"
    >> > Type="DateTime" />
    >> > <asp:parameter Name="inv_item_invoicenumber" Type="String" />
    >> > <asp:parameter Name="inv_item_invoicedate" Type="DateTime" />
    >> > <asp:parameter Name="Original_inv_item_id" Type="Int32" />
    >> > </UpdateParameters>
    >> > <SelectParameters>
    >> > <asp:ControlParameter ControlID="gvItemList" Name="inv_item_id"
    >> > PropertyName="SelectedValue"
    >> > Type="Int32" />
    >> > </SelectParameters>
    >> > </asp:ObjectDataSource>
    >> >

    >
    CK, Aug 7, 2006
    #4
  5. Guest

    Sorry, I meant to include this in the last post, but when I assign the
    DefaultValue, it works on the first try, but not on subsequent updates.


    For example:
    If I edit item 1, assigning DefaultValue works. If I try to edit item
    1 again, it doesn't work.
    But, if after editing item 1 I edit item 2, that works and going back
    to item 1 works as well. It's like it won't work twice in a row...

    Any thoughts?

    Thanks!
    Jason

    CK wrote:
    > Assigning the default value to the desired value at run time should work. I
    > apologize I was answering that off the top of my head.
    >
    > <> wrote in message
    > news:...
    > > Thank you for the help. I didn't know how to access the Parameters
    > > collection.
    > >
    > > Some feedback though:
    > > 1. I do have an Update Method specified in the ObjectDataSource
    > > definition. It's UpdateItemByID.
    > > 2. If I use your first suggesstion, I get an error stating that it
    > > cannot find Control 'ddlPerson' in ControlParameter 'PersonID'
    > > 3. If I use your second suggestion, I don't find a "Value" property in
    > > the UpdateParameters collection of the ObjectDataSource. I find
    > > DefaultValue, but not Value.
    > >
    > > Thanks!
    > >
    > > CK wrote:
    > >> You need to specifiy the update method that will be used in your
    > >> datasource
    > >> and you need some Control Update parameters. It would look something like
    > >> this.
    > >>
    > >> <UpdateParameters>
    > >>
    > >>
    > >> <asp:ControlParameter ControlID="ddlPerson" PropertyName="SelectedValue"
    > >> Name="PersonID" />
    > >>
    > >> </UpdateParameters>
    > >>
    > >> Alternatively you could set the control parameter when you need it.
    > >> Something like this
    > >>
    > >> ObjectDataSoure.UpdateParameters[0].value =
    > >> ((DropDownList)dvEditItem.FindControl('ddlPerson')).SelectedValue;
    > >>
    > >> ObjectDataSource.Update();
    > >>
    > >> Something like that should work for you. HTH.
    > >>
    > >> ~CK
    > >>
    > >>
    > >>
    > >> <> wrote in message
    > >> news:...
    > >> >I have a gridview and a details view in a page. The two are hooked up,
    > >> > so that when a row is selected in the GridView, the DetailsView
    > >> > displays the details. But, what I'm trying to accomplish is this:
    > >> >
    > >> > I have two tables - user and item.
    > >> > user table:
    > >> > user_id int
    > >> > user_name varchar(50)
    > >> >
    > >> > item table:
    > >> > item_id int
    > >> > user_id int (foreign key from user table)
    > >> > item_name varchar(50)
    > >> >
    > >> > The item table contains inventory items and it has a foreign key from
    > >> > the user table indicating which user posseses that inventory. However,
    > >> > when editing this item, if I need to change the user to whom it is
    > >> > assigned, I want to display the user's name rather than the users id
    > >> > from the item table in a DropDownList in the DetailsView. So what I
    > >> > have done to accomplish this is create a TemplateField that holds a
    > >> > DropDownList and an ObjectDataSource that populates the DDL with all of
    > >> > the possible users. And in the DataBound event, I select the user's
    > >> > name in the DDL to whom the item is currently assigned. But I don't
    > >> > know how to capture the selected user'd id and pass it to the Update
    > >> > method in the ObjectDataSource for the DetailsView. I hope this has
    > >> > been clear...
    > >> >
    > >> > Here is some code:
    > >> > <asp:DetailsView ID="dvEditItem" runat="server" Height="50px"
    > >> > GridLines="None" AutoGenerateRows="False" DataKeyNames="inv_item_id"
    > >> > DataSourceID="odsInventoryItem" DefaultMode="Edit"
    > >> > OnItemUpdated="dvEditItem_ItemUpdated" >
    > >> > <Fields>
    > >> > <asp:TemplateField HeaderText="User"
    > >> > SortExpression="inv_person_id">
    > >> > <EditItemTemplate>
    > >> > <asp:DropDownList ID="ddlPerson" runat="server"
    > >> > CssClass="textGrey10" DataSourceID="odsInventoryPerson"
    > >> > DataTextField="corp_person_fullname"
    > >> > DataValueField="corp_person_id" Width="244px"
    > >> > OnDataBound="ddlPerson_DataBound">
    > >> > </asp:DropDownList>
    > >> > <asp:ObjectDataSource ID="odsInventoryPerson" runat="server"
    > >> > OldValuesParameterFormatString="original_{0}"
    > >> > SelectMethod="GetUndeletedPeople"
    > >> > TypeName="dsPersonTableAdapters.tbcorp_personTableAdapter">
    > >> > </asp:ObjectDataSource>
    > >> > </EditItemTemplate>
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:TemplateField>
    > >> > <asp:BoundField DataField="inv_item_description"
    > >> > HeaderText="Description" SortExpression="inv_item_description">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_serial" HeaderText="Serial
    > >> > Number" SortExpression="inv_item_serial">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_workauthorization"
    > >> > HeaderText="Work Authorization"
    > >> > SortExpression="inv_item_workauthorization">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_purchasecost"
    > >> > HeaderText="Purchase Cost" SortExpression="inv_item_purchasecost">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_podate" HeaderText="PO Date"
    > >> > SortExpression="inv_item_podate">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_warrantyexpiration"
    > >> > HeaderText="Warranty Expires"
    > >> > SortExpression="inv_item_warrantyexpiration">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_invoicenumber"
    > >> > HeaderText="Invoice Number" SortExpression="inv_item_invoicenumber">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:BoundField DataField="inv_item_invoicedate"
    > >> > HeaderText="Invoice Date" SortExpression="inv_item_invoicedate">
    > >> > <ControlStyle CssClass="detailsViewControlSmall" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:BoundField>
    > >> > <asp:CheckBoxField DataField="inv_item_active"
    > >> > HeaderText="Active" SortExpression="inv_item_active">
    > >> > <ItemStyle HorizontalAlign="Left" Width="50px" />
    > >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    > >> > </asp:CheckBoxField>
    > >> > <asp:CommandField ButtonType="Button" ShowCancelButton="False"
    > >> > ShowEditButton="True">
    > >> > <ControlStyle CssClass="textGrey10" />
    > >> > </asp:CommandField>
    > >> > </Fields>
    > >> > </asp:DetailsView>
    > >> > <asp:ObjectDataSource ID="odsInventoryItem" runat="server"
    > >> > OldValuesParameterFormatString="original_{0}"
    > >> > SelectMethod="GetInventoryItemByID"
    > >> > TypeName="dsItemTableAdapters.tbinv_itemTableAdapter"
    > >> > UpdateMethod="UpdateItemByID" >
    > >> > <UpdateParameters>
    > >> > <asp:parameter Name="corp_person_id" Type="Int32" />
    > >> > <asp:parameter Name="inv_item_description" Type="String" />
    > >> > <asp:parameter Name="inv_item_serial" Type="String" />
    > >> > <asp:parameter Name="inv_item_workauthorization" Type="String"
    > >> > />
    > >> > <asp:parameter Name="inv_item_purchasecost" Type="Single" />
    > >> > <asp:parameter Name="inv_item_podate" Type="DateTime" />
    > >> > <asp:parameter Name="inv_item_active" Type="Boolean" />
    > >> > <asp:parameter Name="inv_item_warrantyexpiration"
    > >> > Type="DateTime" />
    > >> > <asp:parameter Name="inv_item_invoicenumber" Type="String" />
    > >> > <asp:parameter Name="inv_item_invoicedate" Type="DateTime" />
    > >> > <asp:parameter Name="Original_inv_item_id" Type="Int32" />
    > >> > </UpdateParameters>
    > >> > <SelectParameters>
    > >> > <asp:ControlParameter ControlID="gvItemList" Name="inv_item_id"
    > >> > PropertyName="SelectedValue"
    > >> > Type="Int32" />
    > >> > </SelectParameters>
    > >> > </asp:ObjectDataSource>
    > >> >

    > >
    , Aug 7, 2006
    #5
  6. CK Guest

    try a function that returns the desired value. Like

    public string getDDLvalue()
    {
    return
    ((DropDownList)dvEditItem.FindControl('ddlPerson')).SelectedValue;
    }

    then try
    ObjectDataSoure.UpdateParameters[0].value = getDDLValue();

    Maybe that will work better for you. I am not sure.
    ~CK

    <> wrote in message
    news:...
    > Sorry, I meant to include this in the last post, but when I assign the
    > DefaultValue, it works on the first try, but not on subsequent updates.
    >
    >
    > For example:
    > If I edit item 1, assigning DefaultValue works. If I try to edit item
    > 1 again, it doesn't work.
    > But, if after editing item 1 I edit item 2, that works and going back
    > to item 1 works as well. It's like it won't work twice in a row...
    >
    > Any thoughts?
    >
    > Thanks!
    > Jason
    >
    > CK wrote:
    >> Assigning the default value to the desired value at run time should work.
    >> I
    >> apologize I was answering that off the top of my head.
    >>
    >> <> wrote in message
    >> news:...
    >> > Thank you for the help. I didn't know how to access the Parameters
    >> > collection.
    >> >
    >> > Some feedback though:
    >> > 1. I do have an Update Method specified in the ObjectDataSource
    >> > definition. It's UpdateItemByID.
    >> > 2. If I use your first suggesstion, I get an error stating that it
    >> > cannot find Control 'ddlPerson' in ControlParameter 'PersonID'
    >> > 3. If I use your second suggestion, I don't find a "Value" property in
    >> > the UpdateParameters collection of the ObjectDataSource. I find
    >> > DefaultValue, but not Value.
    >> >
    >> > Thanks!
    >> >
    >> > CK wrote:
    >> >> You need to specifiy the update method that will be used in your
    >> >> datasource
    >> >> and you need some Control Update parameters. It would look something
    >> >> like
    >> >> this.
    >> >>
    >> >> <UpdateParameters>
    >> >>
    >> >>
    >> >> <asp:ControlParameter ControlID="ddlPerson"
    >> >> PropertyName="SelectedValue"
    >> >> Name="PersonID" />
    >> >>
    >> >> </UpdateParameters>
    >> >>
    >> >> Alternatively you could set the control parameter when you need it.
    >> >> Something like this
    >> >>
    >> >> ObjectDataSoure.UpdateParameters[0].value =
    >> >> ((DropDownList)dvEditItem.FindControl('ddlPerson')).SelectedValue;
    >> >>
    >> >> ObjectDataSource.Update();
    >> >>
    >> >> Something like that should work for you. HTH.
    >> >>
    >> >> ~CK
    >> >>
    >> >>
    >> >>
    >> >> <> wrote in message
    >> >> news:...
    >> >> >I have a gridview and a details view in a page. The two are hooked
    >> >> >up,
    >> >> > so that when a row is selected in the GridView, the DetailsView
    >> >> > displays the details. But, what I'm trying to accomplish is this:
    >> >> >
    >> >> > I have two tables - user and item.
    >> >> > user table:
    >> >> > user_id int
    >> >> > user_name varchar(50)
    >> >> >
    >> >> > item table:
    >> >> > item_id int
    >> >> > user_id int (foreign key from user table)
    >> >> > item_name varchar(50)
    >> >> >
    >> >> > The item table contains inventory items and it has a foreign key
    >> >> > from
    >> >> > the user table indicating which user posseses that inventory.
    >> >> > However,
    >> >> > when editing this item, if I need to change the user to whom it is
    >> >> > assigned, I want to display the user's name rather than the users id
    >> >> > from the item table in a DropDownList in the DetailsView. So what I
    >> >> > have done to accomplish this is create a TemplateField that holds a
    >> >> > DropDownList and an ObjectDataSource that populates the DDL with all
    >> >> > of
    >> >> > the possible users. And in the DataBound event, I select the user's
    >> >> > name in the DDL to whom the item is currently assigned. But I don't
    >> >> > know how to capture the selected user'd id and pass it to the Update
    >> >> > method in the ObjectDataSource for the DetailsView. I hope this has
    >> >> > been clear...
    >> >> >
    >> >> > Here is some code:
    >> >> > <asp:DetailsView ID="dvEditItem" runat="server" Height="50px"
    >> >> > GridLines="None" AutoGenerateRows="False" DataKeyNames="inv_item_id"
    >> >> > DataSourceID="odsInventoryItem" DefaultMode="Edit"
    >> >> > OnItemUpdated="dvEditItem_ItemUpdated" >
    >> >> > <Fields>
    >> >> > <asp:TemplateField HeaderText="User"
    >> >> > SortExpression="inv_person_id">
    >> >> > <EditItemTemplate>
    >> >> > <asp:DropDownList ID="ddlPerson" runat="server"
    >> >> > CssClass="textGrey10" DataSourceID="odsInventoryPerson"
    >> >> > DataTextField="corp_person_fullname"
    >> >> > DataValueField="corp_person_id" Width="244px"
    >> >> > OnDataBound="ddlPerson_DataBound">
    >> >> > </asp:DropDownList>
    >> >> > <asp:ObjectDataSource ID="odsInventoryPerson" runat="server"
    >> >> > OldValuesParameterFormatString="original_{0}"
    >> >> > SelectMethod="GetUndeletedPeople"
    >> >> > TypeName="dsPersonTableAdapters.tbcorp_personTableAdapter">
    >> >> > </asp:ObjectDataSource>
    >> >> > </EditItemTemplate>
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:TemplateField>
    >> >> > <asp:BoundField DataField="inv_item_description"
    >> >> > HeaderText="Description" SortExpression="inv_item_description">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_serial" HeaderText="Serial
    >> >> > Number" SortExpression="inv_item_serial">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_workauthorization"
    >> >> > HeaderText="Work Authorization"
    >> >> > SortExpression="inv_item_workauthorization">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_purchasecost"
    >> >> > HeaderText="Purchase Cost" SortExpression="inv_item_purchasecost">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_podate" HeaderText="PO Date"
    >> >> > SortExpression="inv_item_podate">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_warrantyexpiration"
    >> >> > HeaderText="Warranty Expires"
    >> >> > SortExpression="inv_item_warrantyexpiration">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_invoicenumber"
    >> >> > HeaderText="Invoice Number" SortExpression="inv_item_invoicenumber">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:BoundField DataField="inv_item_invoicedate"
    >> >> > HeaderText="Invoice Date" SortExpression="inv_item_invoicedate">
    >> >> > <ControlStyle CssClass="detailsViewControlSmall" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:BoundField>
    >> >> > <asp:CheckBoxField DataField="inv_item_active"
    >> >> > HeaderText="Active" SortExpression="inv_item_active">
    >> >> > <ItemStyle HorizontalAlign="Left" Width="50px" />
    >> >> > <HeaderStyle CssClass="detailsViewHeaderText" />
    >> >> > </asp:CheckBoxField>
    >> >> > <asp:CommandField ButtonType="Button" ShowCancelButton="False"
    >> >> > ShowEditButton="True">
    >> >> > <ControlStyle CssClass="textGrey10" />
    >> >> > </asp:CommandField>
    >> >> > </Fields>
    >> >> > </asp:DetailsView>
    >> >> > <asp:ObjectDataSource ID="odsInventoryItem" runat="server"
    >> >> > OldValuesParameterFormatString="original_{0}"
    >> >> > SelectMethod="GetInventoryItemByID"
    >> >> > TypeName="dsItemTableAdapters.tbinv_itemTableAdapter"
    >> >> > UpdateMethod="UpdateItemByID" >
    >> >> > <UpdateParameters>
    >> >> > <asp:parameter Name="corp_person_id" Type="Int32" />
    >> >> > <asp:parameter Name="inv_item_description" Type="String" />
    >> >> > <asp:parameter Name="inv_item_serial" Type="String" />
    >> >> > <asp:parameter Name="inv_item_workauthorization" Type="String"
    >> >> > />
    >> >> > <asp:parameter Name="inv_item_purchasecost" Type="Single" />
    >> >> > <asp:parameter Name="inv_item_podate" Type="DateTime" />
    >> >> > <asp:parameter Name="inv_item_active" Type="Boolean" />
    >> >> > <asp:parameter Name="inv_item_warrantyexpiration"
    >> >> > Type="DateTime" />
    >> >> > <asp:parameter Name="inv_item_invoicenumber" Type="String" />
    >> >> > <asp:parameter Name="inv_item_invoicedate" Type="DateTime" />
    >> >> > <asp:parameter Name="Original_inv_item_id" Type="Int32" />
    >> >> > </UpdateParameters>
    >> >> > <SelectParameters>
    >> >> > <asp:ControlParameter ControlID="gvItemList" Name="inv_item_id"
    >> >> > PropertyName="SelectedValue"
    >> >> > Type="Int32" />
    >> >> > </SelectParameters>
    >> >> > </asp:ObjectDataSource>
    >> >> >
    >> >

    >
    CK, Aug 7, 2006
    #6
  7. Guest

    That didn't work.

    I'll keep looking, but thank you for your help! If you do think of
    something else, though, let me know.

    Jason
    , Aug 7, 2006
    #7
  8. CK Guest

    When are you trying to retreive and set the value?
    Try it in the ObjectDataSource1_Updating event. You'll need to register that
    event. Probably like in the PageLoad event
    Try retrieving and setting the value in that event maybe. Sorry i wish i
    could help you more.

    <> wrote in message
    news:...
    > That didn't work.
    >
    > I'll keep looking, but thank you for your help! If you do think of
    > something else, though, let me know.
    >
    > Jason
    >
    CK, Aug 7, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    0
    Views:
    560
    Steve
    Sep 19, 2005
  2. =?Utf-8?B?UXVhbiBOZ3V5ZW4=?=

    Databind problem with DetailsView's template fields

    =?Utf-8?B?UXVhbiBOZ3V5ZW4=?=, Aug 27, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    529
    =?Utf-8?B?UXVhbiBOZ3V5ZW4=?=
    Aug 27, 2007
  3. gerry
    Replies:
    3
    Views:
    2,017
    Walter Wang [MSFT]
    Sep 26, 2007
  4. Seth Williams

    DetailsView with only certain fields editable

    Seth Williams, Sep 16, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    384
    Seth Williams
    Sep 16, 2008
  5. Feege
    Replies:
    0
    Views:
    436
    Feege
    Dec 20, 2005
Loading...

Share This Page