Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ObjectDataSource and FormView

Reply
Thread Tools

ObjectDataSource and FormView

 
 
Sasa
Guest
Posts: n/a
 
      06-21-2007
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


 
Reply With Quote
 
 
 
 
Sasa
Guest
Posts: n/a
 
      06-21-2007
Thanks

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





"David R. Longnecker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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/lib...tstring.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
>
>



 
Reply With Quote
 
 
 
 
Sasa
Guest
Posts: n/a
 
      06-23-2007
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>
<asparameter Name="Original_id" Type="Int32" />
<asparameter Name="Original_PostCode" Type="String" />
<asparameter Name="Original_PU" Type="String" />
<asparameter Name="Original_City" Type="String" />
<asparameter Name="Original_Area" Type="String" />
<asparameter Name="Original_Country" Type="Int32" />
<asparameter Name="Original_Tax" Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="PostCode" Type="String" />
<asparameter Name="PU" Type="String" />
<asparameter Name="City" Type="String" />
<asparameter Name="Area" Type="String" />
<asparameter Name="Country" Type="Int32" />
<asparameter Name="Tax" Type="Decimal" />
<asparameter Name="Original_id" Type="Int32" />
<asparameter Name="Original_PostCode" Type="String" />
<asparameter Name="Original_PU" Type="String" />
<asparameter Name="Original_City" Type="String" />
<asparameter Name="Original_Area" Type="String" />
<asparameter Name="Original_Country" Type="Int32" />
<asparameter Name="Original_Tax" Type="Decimal" />
<asparameter Name="id" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="TableMjestaPregled" Name="id"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asparameter Name="PostCode" Type="String" />
<asparameter Name="PU" Type="String" />
<asparameter Name="City" Type="String" />
<asparameter Name="Area" Type="String" />
<asparameter Name="Country" Type="Int32" />
<asparameter Name="Tax" Type="Decimal" />
</InsertParameters>
</asp:ObjectDataSource>
"David R. Longnecker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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" <(E-Mail Removed)> wrote in
> message
> S> news:(E-Mail Removed) om...
> 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/lib....webcontrols.o
>>> bjectdatasource.oldvaluesparameterformatstring.asp x):
>>>
>>> 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

>
>



 
Reply With Quote
 
Sasa
Guest
Posts: n/a
 
      06-23-2007
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"


 
Reply With Quote
 
Sasa
Guest
Posts: n/a
 
      06-23-2007
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FormView, ObjectDataSource and the evil binding KaOne ASP .Net 3 06-20-2007 09:22 AM
Formview FileUpload and ObjectDataSource Chris ASP .Net 5 03-31-2007 09:39 PM
FormView and ObjectDataSource events J055 ASP .Net 2 03-22-2007 09:57 AM
Formview and objectdatasource with int values and null textboxes Pao ASP .Net 1 12-30-2006 03:14 PM
FormView and ObjectDataSource - Delete doesn't work =?Utf-8?B?Sm9obiBCYWlsZXk=?= ASP .Net 4 06-03-2005 06:24 PM



Advertisments