GRIDVIEW EDIT,UPDATE,DELETE
protected
void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
loaddata();
}
protected
void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int PersonID
= int.Parse (((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text);
string Pname = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
string sid = ((TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
string sunit = ((TextBox)GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text;
try
{
addbal.update(PersonID, Pname, sid, sunit);
}
catch (Exception
ex)
{
}
finally
{
}
GridView1.EditIndex = -1;
loaddata();
}
protected
void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int PersonID
= Int32.Parse(GridView1.Rows[e.RowIndex].Cells[1].Text);
try
{
addbal.delete(PersonID);
}
catch (Exception
ex)
{
}
finally
{
}
loaddata();
}
protected
void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex =-1;
loaddata();
}
more updates follows
ReplyDelete