Question about ObjectDataSource.DataObjectTypeName

Discussion in 'ASP .Net' started by =?Utf-8?B?aGFwcHluaXUxOTg1?=, Jun 27, 2005.

  1. It's serious.

    This is my interface:
    public interface IData
    {
    Guid UserId { get; set; }
    string IDataType { get; }
    }

    and my class:
    public class StudentData : IData
    {
    private Guid userId = Guid.Empty;
    public Guid UserId { ... }

    private string name = "";
    public string Name { ... }

    private int age = 0;
    public int Age { ... }
    }

    and the data provider
    public class FormViewDataProvider
    {
    ... // Codes to get the data

    public void Set(IData i) // Update Method
    {
    ...
    }
    }

    now if i copy all the codes into a windows application and call it like the
    following:

    StudentData s = new StudentData();
    FormViewDataProvider fvdp = new FormViewDataProvider();
    fvdp.Set(s);

    it'll work well

    but if i use ObjectDataProvider and FormView and set ObjectDataProvider's
    property ObjectDataTypeName = StudentData, when i update the FormView it'll
    throw an exception:

    ObjectDataSource 'ObjectDataSource2' could not find a non-generic method
    'Set' that takes parameters of type 'StudentData'.

    could somebody help me?

    Stack Trace:

    [InvalidOperationException: ObjectDataSource 'ObjectDataSource2' could not
    find a non-generic method 'Set' that takes parameters of type 'StudentData'.]
    System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type
    type, String methodName, Type dataObjectType, Object oldDataObject, Object
    newDataObject, DataSourceOperation operation) +664
    System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary
    keys, IDictionary values, IDictionary oldValues) +1512
    System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values,
    IDictionary oldValues, DataSourceViewOperationCallback callback) +179
    System.Web.UI.WebControls.FormView.HandleUpdate(String commandArg,
    Boolean causesValidation) +1187
    System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean
    causesValidation, String validationGroup) +851
    System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs
    e) +163
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
    System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source,
    EventArgs e) +118
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +107
    System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
    eventArgument) +165

    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument) +32
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3871



    --
    Good good study, day day up...
     
    =?Utf-8?B?aGFwcHluaXUxOTg1?=, Jun 27, 2005
    #1
    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. Phillip Ian
    Replies:
    1
    Views:
    2,990
  2. Replies:
    1
    Views:
    4,200
  3. Martin
    Replies:
    1
    Views:
    1,289
    Martin
    Jun 27, 2006
  4. Anabela Silva
    Replies:
    0
    Views:
    1,238
    Anabela Silva
    Nov 1, 2006
  5. Kernel Bling
    Replies:
    9
    Views:
    1,996
    =?Utf-8?B?VG9ueSBM?=
    Oct 2, 2007
Loading...

Share This Page