Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Manual Crud (Deletion and Updation)
posted

hi all...

am new to inforgistics and am a budding programmer.I am really so happy to see all the features that I was once wishing to be there in my application. am learing from tutorials.

there I had one doubt abt

public partial class Web1 : System.Web.UI.Page

{

private PersonRepository Repository

{

get

{

if (this._repository == null)

{

return new WebStateRepository<PersonRepository>().Instance;

 

}

return this._repository;

}

}

private PersonRepository _repository = null;

 

 

 

 

protected void ods_ObjectCreating(object sender, ObjectDataSourceEventArgs e)

{

e.ObjectInstance = this.Repository;

}

}

---------------------------------------------------------------------

public class PersonRepository

{

private IList<Person> _people = new List<Person>();

public PersonRepository()

{

this.InitializeData();

}

public void Insert(Person person)

{

this._people.Add(person);

}

private void InitializeData()

{

_people.Add(new Person()

{

FirstName = "Otto",

SecondName = "Parts",

LastLoginDate = new DateTime(2009, 4, 3),

PersonTypeId = 1,

PersonTypeTitle = "Expert User",

Id = 1

});

_people.Add(new Person()

{

FirstName = "Gym",

SecondName = "Nasium",

LastLoginDate = new DateTime(2010, 5, 3),

PersonTypeId = 1,

PersonTypeTitle = "Super User",

Id = 2

});

_people.Add(new Person()

{

FirstName = "Nara",

SecondName = "Simha",

LastLoginDate = new DateTime(2009, 5, 3),

PersonTypeId = 2,

PersonTypeTitle = "Poor User",

Id = 3

});

_people.Add(new Person()

{

FirstName = "Kizhakkan",

SecondName = "Pathros",

LastLoginDate = new DateTime(2012, 5, 4),

PersonTypeId = 2,

PersonTypeTitle = "Descent User",

Id = 4

});

 

}

public IList<Person> GetAll()

{

return this._people;

}

public void Delete(Person person)

{

for (int i = 0; i < this._people.Count - 1; i++)

{

if (this._people[i].Id == person.Id)

{

this._people.Remove(this._people[i]);

}

}

}

public void Delete(int Id)

{

for (int i = 0; i < this._people.Count - 1; i++)

{

if (this._people[i].Id == Id)

{

this._people.Remove(this._people[i]);

}

}

}

public void Update(Person person)

{

for (int i = 0; i < this._people.Count - 1; i++)

{

if (this._people[i].Id == person.Id)

{

this._people.Remove(this._people[i]);

this._people.Insert(i, person);

}

}

}

}

----------------------------

then how

return new WebStateRepository<PersonRepository>().Instance;

is created? I tried a lot and I couldnot find this.. Kindly help




Forum: WebDataGrid
Posted On: Feb 3, 7:42 AM [GMT -5]
Post Subject: Re: Adding a New Row not displaying on Grid
Post author: [Infragistics] Petar Ivanov

Hi apalcer,

It has been some time since your post, however in case you still need assistance I would be glad to help.

As far as I can understand, after adding the new row through the grid UI, an AJAX call is occurring for you. Please ensure that the new row is being added to your datasource. If using AutoCRUD, the grid's data source also needs to support automatic CRUD operations (otherwise manual CRUD should be employed).

If you need to access the new row object clientside, this can be done in the RowAdding clientside handler using something similar to:

eventArgs.get_row()

Please feel free to contact me if you have any questions.