asp.netasp.net-dynamic-data

asp.net dynamic data web site : passing default value while inserting/updating records


I am working in ASP.NET Dynamic Data web application and have an issue of passing default value while inserting/updating records. In my application all table has following common column:

I want to keep these column hide in Insert and Edit page and want that default value will be inserted automatically in the respective column.

Please suggest me.

Thanks paul


Solution

  • solution i have implemented finally:

    protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
       {
          e.Values.Add("CreatedBy", HttpContext.Current.User.Identity.Name);
          e.Values.Add("CreatedDate", DateTime.Now);
        }
    
     protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
          e.OldValues.Add("ModifiedBy", null);
          e.OldValues.Add("ModifiedDate", null);
          e.NewValues.Add("ModifiedBy", HttpContext.Current.User.Identity.Name);
          e.NewValues.Add("ModifiedDate", DateTime.Now);
       }