Hi,
I used the textbox in edit template for update the values in gridview. But I got the problem(Collection was modified; enumeration operation may not execute.) .Please give me the solution.
My Code behind code:
protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
GridDataItem id = (e.Item as GridDataItem);
string Empid = id.OwnerTableView.DataKeyValues[id.ItemIndex]["EmpId"].ToString();
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
{
TextBox txtleavetaken = (TextBox)item.FindControl("txttakenleave");
TextBox txtleaveremain = (TextBox)item.FindControl("txtleavecount");
TextBox txttotalworkdays = (TextBox)item.FindControl("txttotalworkdays");
TextBox txtadvance = (TextBox)item.FindControl("txtadvance");
TextBox txtbonus = (TextBox)item.FindControl("txtbonus");
TextBox txtothers = (TextBox)item.FindControl("txtothers");
TextBox txttotalsalary = (TextBox)item.FindControl("txttotalsalary");
objpl.empname = Empid.ToString();
objpl.takenleave = txtleavetaken.Text;
objpl.leave = txtleaveremain.Text;
objpl.totalworkdays = txttotalworkdays.Text;
objpl.empadvance = txtadvance.Text;
objpl.bonus = txtbonus.Text;
objpl.empothers = txtothers.Text;
objpl.totalsalary = txttotalsalary.Text;
objbl.updatesalarydetail(objpl);
fullviewstaff();
}
Thanks,
Arun.
I used the textbox in edit template for update the values in gridview. But I got the problem(Collection was modified; enumeration operation may not execute.) .Please give me the solution.
My Code behind code:
protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
GridDataItem id = (e.Item as GridDataItem);
string Empid = id.OwnerTableView.DataKeyValues[id.ItemIndex]["EmpId"].ToString();
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
{
TextBox txtleavetaken = (TextBox)item.FindControl("txttakenleave");
TextBox txtleaveremain = (TextBox)item.FindControl("txtleavecount");
TextBox txttotalworkdays = (TextBox)item.FindControl("txttotalworkdays");
TextBox txtadvance = (TextBox)item.FindControl("txtadvance");
TextBox txtbonus = (TextBox)item.FindControl("txtbonus");
TextBox txtothers = (TextBox)item.FindControl("txtothers");
TextBox txttotalsalary = (TextBox)item.FindControl("txttotalsalary");
objpl.empname = Empid.ToString();
objpl.takenleave = txtleavetaken.Text;
objpl.leave = txtleaveremain.Text;
objpl.totalworkdays = txttotalworkdays.Text;
objpl.empadvance = txtadvance.Text;
objpl.bonus = txtbonus.Text;
objpl.empothers = txtothers.Text;
objpl.totalsalary = txttotalsalary.Text;
objbl.updatesalarydetail(objpl);
fullviewstaff();
}
Thanks,
Arun.