ObjectDataSource and Guid Delete Parameter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    ObjectDataSource and Guid Delete Parameter

    Hello,

    I am trying to define an ObjectDataSourc e delete parameter.
    The parameter name is "TagID" and is a Guid:

    ObjectDataSourc e1.DeleteParame ters.Add(new Parameter("ID",
    TypeCode.Object ))

    And the Delete Method defined in the ObjectDataSourc e is as follows:

    [DataObjectMetho dAttribute(Data ObjectMethodTyp e.Delete, true)]
    public static void Delete(object TagID)
    {
    CodeDataContext database = new CodeDataContext ();
    Tag query = (from t in database.Tags
    where t.TagID == new guid(TagID.ToSt ring)
    select t).Single();
    database.Tags.D eleteOnSubmit(t ag);
    }

    I debugged my code and the input TagID in Delete is empty.
    The object is recognized as a Guid but it is empty.

    And in my ListView I defined the KeyNames:
    ods.DataKeyName s = new string[] {"TagID"};
    ods.DataSourceI D = "ldsTags";

    Justfor testing I made added a column in the ListView to display the
    TagID and it is visible.

    What am I doing wrong?

    Thanks,

    Miguel
Working...