Hi,
I am trying to delete a row in datagrid. I am primarily working with two classes, UserInfo and UserInfoUtility.
UserInfo is the class object that stores the data representation of the users table in the database. It exposes properties such as ID,FirstName, Lastname etc. And provides constructors such as UserInfo(), UserInfo(DataRow dr) etc.
UserInfoUtility provides database access to this table and provides methods such as RetrieveUserByExternal(string id), DeleteUser(UserInfo ui, bool using ExternalID) etc.
Now, i am using the delete comman in datagrid, My code for the delete command is as follows.
protected void DataGrid1_DeleteCommand(object source, DataGridCommandEventArgs e)
{
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
UserInfo ui = UserInfoUtility.RetrieveUserByExternal(key); //I am getting the following error " An object reference is required for the nonstatic field, method, or property 'Com.Rpi.Erma.Records.UserInfoUtility.DeleteUser(Com.Rpi.Erma.Records.UserInfo, bool)' "
UserInfoUtility.DeleteUser(ui, true);
DataGrid1.EditItemIndex = -1;
PerformSearch();
}
Can anyone tell me, as to what mistake i am doing and how should i write the code to delete the user from the database using datagrid. I am fairly new to ASP and C#. Kindly help me. Its very urgent.
Thanks
Zaid Papa
Enter your message below
Sign in or Join us (it's free).