ObjectDataSource and FormView

Discussion in 'ASP .Net Web Controls' started by Sasa, Jun 21, 2007.

  1. Sasa

    Sasa Guest

    FormView is connected to ObjectDataSource

    Table example

    id
    Name
    Forname

    when ObjectDataSource is set
    ConflictDetection = OverwriteChanges

    I have error ObjectDataSource could not find a non-generic method that have
    parameters:
    Name, Forname, Orginal_id,Orginal_Name, Orginal_Forname, id, Orginal_id

    ?? Why orginal values?

    when ObjectDataSource is set to
    ConflictDetection = CompareAllValues ( I need so)
    OldValuesParamteresFormatString = Orginal_{0}

    Error message is
    ObjectDataSource could not find a non-generic method that have parameters:
    Name, Forname, Orginal_id,Orginal_Name, Orginal_Forname, id,
    Orginal_id,Orginal_Name, Orginal_Forname,Orginal_id

    In FormView I bind all Fields one time

    Why?

    Thanks
    Sasa
    aagincic@<<>>inet.hr
    Sasa, Jun 21, 2007
    #1
    1. Advertising

  2. Sasa

    Sasa Guest

    Thanks

    But while in second case FormView send two time Orginal params ?





    "David R. Longnecker" <> wrote in message
    news:...
    > Sasa-
    >
    > At first glance, I'd assume that it's looking for the Original parameters
    > because that's what you specified:
    >
    > S> OldValuesParamteresFormatString = Orginal_{0}
    >
    > From MSDN
    > (http://msdn2.microsoft.com/en-US/li...asource.oldvaluesparameterformatstring.aspx):
    >
    > The following are two common scenarios where you might change the
    > OldValuesParameterFormatString property:
    >
    > - You might want to change the property to differentiate between old and
    > new values in updates. When the ConflictDetection property is set to the
    > CompareAllValues value, parameters for both the original and new values
    > are added to the UpdateParameters collection. Without the formatting
    > string, two parameters with the same name would be created for each data
    > field. By changing the name of the original value parameter, you can
    > compare the data to the original data source to detect conflicts and
    > compare key values.
    >
    > - Some visual designers implement a particular naming scheme for original
    > values and keys.
    >
    > If your form's parameters are simply called Name, Forname, etc--that which
    > match the ODS, I believe you can leave that out or modify the method that
    > the ODS is using when it calls .Update() to accomodate both the "updating"
    > information and the "original" information.
    >
    > -dl
    >
    > --
    > David R. Longnecker
    > http://blog.tiredstudent.com
    >
    > S> FormView is connected to ObjectDataSource
    > S> S> Table example
    > S> S> id
    > S> Name
    > S> Forname
    > S> when ObjectDataSource is set
    > S> ConflictDetection = OverwriteChanges
    > S> I have error ObjectDataSource could not find a non-generic method
    > S> that have
    > S> parameters:
    > S> Name, Forname, Orginal_id,Orginal_Name, Orginal_Forname, id,
    > S> Orginal_id
    > S> ?? Why orginal values?
    > S> S> when ObjectDataSource is set to
    > S> ConflictDetection = CompareAllValues ( I need so)
    > S> OldValuesParamteresFormatString = Orginal_{0}
    > S> Error message is
    > S> ObjectDataSource could not find a non-generic method that have
    > S> parameters:
    > S> Name, Forname, Orginal_id,Orginal_Name, Orginal_Forname, id,
    > S> Orginal_id,Orginal_Name, Orginal_Forname,Orginal_id
    > S> In FormView I bind all Fields one time
    > S> S> Why?
    > S> S> Thanks
    > S> Sasa
    > S> aagincic@<<>>inet.hr
    >
    >
    Sasa, Jun 21, 2007
    #2
    1. Advertising

  3. Sasa

    Sasa Guest

    Ok :

    <asp:FormView ID="FormView1" runat="server" DataKeyNames="id"
    DataSourceID="DSMjestaEdit">
    <EditItemTemplate>
    id:
    <asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id")
    %>'></asp:Label><br />
    Post code:
    <asp:TextBox ID="PostanskiBrojTextBox" runat="server" Text='<%#
    Bind("PostCode") %>'>
    </asp:TextBox><br />
    PU:
    <asp:TextBox ID="PostanskaUpravaTextBox" runat="server" Text='<%# Bind("PU")
    %>'>
    </asp:TextBox><br />
    City:
    <asp:TextBox ID="MjestoTextBox" runat="server" Text='<%# Bind("City") %>'>
    </asp:TextBox><br />
    Area:
    <asp:TextBox ID="ZupanijaTextBox" runat="server" Text='<%# Bind("Area") %>'>
    </asp:TextBox><br />
    Country:
    <asp:TextBox ID="DrzavaTextBox" runat="server" Text='<%# Bind("Country")
    %>'>
    </asp:TextBox><br />
    Tax:
    <asp:TextBox ID="PrirezTextBox" runat="server" Text='<%# Bind("Tax") %>'>
    </asp:TextBox><br />
    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
    CommandName="Update"
    Text="Update">
    </asp:LinkButton>
    <asp:LinkButton ID="UpdateCancelButton" runat="server"
    CausesValidation="False" CommandName="Cancel"
    Text="Cancel">
    </asp:LinkButton>
    </EditItemTemplate>
    <InsertItemTemplate>
    Postal code:
    <asp:TextBox ID="PostanskiBrojTextBox" runat="server" Text='<%#
    Bind("PostCode") %>'>
    </asp:TextBox><br />
    PU:
    <asp:TextBox ID="PostanskaUpravaTextBox" runat="server" Text='<%# Bind("PU")
    %>'>
    </asp:TextBox><br />
    City:
    <asp:TextBox ID="MjestoTextBox" runat="server" Text='<%# Bind("City") %>'>
    </asp:TextBox><br />
    Area:
    <asp:TextBox ID="ZupanijaTextBox" runat="server" Text='<%# Bind("Area") %>'>
    </asp:TextBox><br />
    Country:
    <asp:TextBox ID="DrzavaTextBox" runat="server" Text='<%# Bind("Country")
    %>'>
    </asp:TextBox><br />
    Tax:
    <asp:TextBox ID="PrirezTextBox" runat="server" Text='<%# Bind("Tax") %>'>
    </asp:TextBox><br />
    <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
    CommandName="Insert"
    Text="Insert">
    </asp:LinkButton>
    <asp:LinkButton ID="InsertCancelButton" runat="server"
    CausesValidation="False" CommandName="Cancel"
    Text="Cancel">
    </asp:LinkButton>
    </InsertItemTemplate>
    <ItemTemplate>
    id:
    <asp:Label ID="idLabel" runat="server" Text='<%# Eval("id")
    %>'></asp:Label><br />
    Postal code:
    <asp:Label ID="PostanskiBrojLabel" runat="server" Text='<%# Bind("PostCode")
    %>'>
    </asp:Label><br />
    PU:
    <asp:Label ID="PostanskaUpravaLabel" runat="server" Text='<%# Bind("PU")
    %>'>
    </asp:Label><br />
    City:
    <asp:Label ID="MjestoLabel" runat="server" Text='<%# Bind("City")
    %>'></asp:Label><br />
    Area:
    <asp:Label ID="ZupanijaLabel" runat="server" Text='<%# Bind("Area")
    %>'></asp:Label><br />
    Country:
    <asp:Label ID="DrzavaLabel" runat="server" Text='<%# Bind("Country")
    %>'></asp:Label><br />
    Tax:
    <asp:Label ID="PrirezLabel" runat="server" Text='<%# Bind("Tax")
    %>'></asp:Label><br />
    <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"
    CommandName="Edit"
    Text="Edit">
    </asp:LinkButton>
    <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False"
    CommandName="Delete"
    Text="Delete">
    </asp:LinkButton>
    <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False"
    CommandName="New"
    Text="New">
    </asp:LinkButton>
    </ItemTemplate>
    </asp:FormView>
    <asp:ObjectDataSource ID="DSMjestaEdit" runat="server"
    ConflictDetection="CompareAllValues"
    DeleteMethod="KontaktMjestaDelete" InsertMethod="KontaktMjestaInsert"
    OldValuesParameterFormatString="Orginal_{0}"
    SelectMethod="KontaktMjestaGetOne" TypeName="VrniServer.Service"
    UpdateMethod="KontaktMjestaUpdate" OnUpdating="DSMjestaEdit_Updating">
    <DeleteParameters>
    <asp:parameter Name="Original_id" Type="Int32" />
    <asp:parameter Name="Original_PostCode" Type="String" />
    <asp:parameter Name="Original_PU" Type="String" />
    <asp:parameter Name="Original_City" Type="String" />
    <asp:parameter Name="Original_Area" Type="String" />
    <asp:parameter Name="Original_Country" Type="Int32" />
    <asp:parameter Name="Original_Tax" Type="Decimal" />
    </DeleteParameters>
    <UpdateParameters>
    <asp:parameter Name="PostCode" Type="String" />
    <asp:parameter Name="PU" Type="String" />
    <asp:parameter Name="City" Type="String" />
    <asp:parameter Name="Area" Type="String" />
    <asp:parameter Name="Country" Type="Int32" />
    <asp:parameter Name="Tax" Type="Decimal" />
    <asp:parameter Name="Original_id" Type="Int32" />
    <asp:parameter Name="Original_PostCode" Type="String" />
    <asp:parameter Name="Original_PU" Type="String" />
    <asp:parameter Name="Original_City" Type="String" />
    <asp:parameter Name="Original_Area" Type="String" />
    <asp:parameter Name="Original_Country" Type="Int32" />
    <asp:parameter Name="Original_Tax" Type="Decimal" />
    <asp:parameter Name="id" Type="Int32" />
    </UpdateParameters>
    <SelectParameters>
    <asp:ControlParameter ControlID="TableMjestaPregled" Name="id"
    PropertyName="SelectedValue"
    Type="Int32" />
    </SelectParameters>
    <InsertParameters>
    <asp:parameter Name="PostCode" Type="String" />
    <asp:parameter Name="PU" Type="String" />
    <asp:parameter Name="City" Type="String" />
    <asp:parameter Name="Area" Type="String" />
    <asp:parameter Name="Country" Type="Int32" />
    <asp:parameter Name="Tax" Type="Decimal" />
    </InsertParameters>
    </asp:ObjectDataSource>
    "David R. Longnecker" <> wrote in message
    news:...
    > Sasa-
    >
    > It shouldn't, but it depends how you're updating. Could you post your
    > code? That may help.
    >
    > -dl
    >
    >
    > --
    > David R. Longnecker
    > http://blog.tiredstudent.com
    >
    > S> Thanks
    > S> S> But while in second case FormView send two time Orginal params ?
    > S> S> "David R. Longnecker" <> wrote in
    > message
    > S> news:...
    > S>
    >>> Sasa-
    >>>
    >>> At first glance, I'd assume that it's looking for the Original
    >>> parameters because that's what you specified:
    >>>
    >>> S> OldValuesParamteresFormatString = Orginal_{0}
    >>>
    >>> From MSDN
    >>> (http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.o
    >>> bjectdatasource.oldvaluesparameterformatstring.aspx):
    >>>
    >>> The following are two common scenarios where you might change the
    >>> OldValuesParameterFormatString property:
    >>>
    >>> - You might want to change the property to differentiate between old
    >>> and new values in updates. When the ConflictDetection property is set
    >>> to the CompareAllValues value, parameters for both the original and
    >>> new values are added to the UpdateParameters collection. Without the
    >>> formatting string, two parameters with the same name would be created
    >>> for each data field. By changing the name of the original value
    >>> parameter, you can compare the data to the original data source to
    >>> detect conflicts and compare key values.
    >>>
    >>> - Some visual designers implement a particular naming scheme for
    >>> original values and keys.
    >>>
    >>> If your form's parameters are simply called Name, Forname, etc--that
    >>> which match the ODS, I believe you can leave that out or modify the
    >>> method that the ODS is using when it calls .Update() to accomodate
    >>> both the "updating" information and the "original" information.
    >>>
    >>> -dl
    >>>
    >>> --
    >>> David R. Longnecker
    >>> http://blog.tiredstudent.com
    >>> S> FormView is connected to ObjectDataSource
    >>> S> S> Table example
    >>> S> S> id
    >>> S> Name
    >>> S> Forname
    >>> S> when ObjectDataSource is set
    >>> S> ConflictDetection = OverwriteChanges
    >>> S> I have error ObjectDataSource could not find a non-generic method
    >>> S> that have
    >>> S> parameters:
    >>> S> Name, Forname, Orginal_id,Orginal_Name, Orginal_Forname, id,
    >>> S> Orginal_id
    >>> S> ?? Why orginal values?
    >>> S> S> when ObjectDataSource is set to
    >>> S> ConflictDetection = CompareAllValues ( I need so)
    >>> S> OldValuesParamteresFormatString = Orginal_{0}
    >>> S> Error message is
    >>> S> ObjectDataSource could not find a non-generic method that have
    >>> S> parameters:
    >>> S> Name, Forname, Orginal_id,Orginal_Name, Orginal_Forname, id,
    >>> S> Orginal_id,Orginal_Name, Orginal_Forname,Orginal_id
    >>> S> In FormView I bind all Fields one time
    >>> S> S> Why?
    >>> S> S> Thanks
    >>> S> Sasa
    >>> S> aagincic@<<>>inet.hr

    >
    >
    Sasa, Jun 23, 2007
    #3
  4. Sasa

    Sasa Guest

    Input parameter values

    first series new values - have new values
    second series of orginal values is empty
    thrid series orginal values have orginal values

    Example:
    City="NewPlaceName"
    ....
    Orginal_City="null"
    ...
    Orginal_City="PlaceName"
    Sasa, Jun 23, 2007
    #4
  5. Sasa

    Sasa Guest

    Update mehtod

    KontaktMjestaUpdate(String PostanskiBroj, String PostanskaUprava, String
    Mjesto, String Zupanija, Nullable<Int32> Drzava, Nullable<Decimal> Prirez,
    Int32 Original_id, String Original_PostanskiBroj, String
    Original_PostanskaUprava, String Original_Mjesto, String Original_Zupanija,
    Nullable<Int32> Original_Drzava, Nullable<Decimal> Original_Prirez, Int32
    id), returns Int32

    Thanks
    sasa
    Sasa, Jun 23, 2007
    #5
    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. =?Utf-8?B?Sm9obiBCYWlsZXk=?=

    FormView and ObjectDataSource - Delete doesn't work

    =?Utf-8?B?Sm9obiBCYWlsZXk=?=, Jun 3, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,358
    =?Utf-8?B?Sm9obiBCYWlsZXk=?=
    Jun 3, 2005
  2. Pao
    Replies:
    1
    Views:
    417
  3. J055
    Replies:
    2
    Views:
    642
    Walter Wang [MSFT]
    Mar 22, 2007
  4. Chris
    Replies:
    5
    Views:
    501
    Jon Paal [MSMD]
    Mar 31, 2007
  5. KaOne
    Replies:
    3
    Views:
    694
    Steven Cheng[MSFT]
    Jun 20, 2007
Loading...

Share This Page