G
geek
Hi all,
I have a datagrid and I want to be able to edit a particular cell in
datagrid row.
I am using the EditCommandColumn control.My problem is when I hit
update the current row doesn't go in the edit mode.
Here is the snippet for asp:
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel"
UpdateText="Update" HeaderText="Edit Column" ButtonType="LinkButton"
HeaderStyle-Wrap="False"
ItemStyle-Wrap="False"></asp:EditCommandColumn>
Here are my edit,update and cancel methods:
public void EditGrid(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ReportDataGrid.EditItemIndex = (int)e.Item.ItemIndex;
//ReportDataGrid.
int foo = (int)e.Item.ItemIndex;
daList.Fill(DS,"Recognition");
daRecipient.Fill(DS,"Recipients");
ReportDataGrid.DataSource = DS;
ReportDataGrid.DataBind();
}
public void Update(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string NewData;
TableCell NotesCell = e.Item.Cells[6];
TextBox EditBox;
EditBox = (TextBox)NotesCell.Controls[0];
NewData = EditBox.Text;
//TODO: modify the data in DB acc to the entry
ReportDataGrid.EditItemIndex = -1;
daList.Fill(DS,"Recognition");
daRecipient.Fill(DS,"Recipients");
ReportDataGrid.DataSource = DS;
ReportDataGrid.DataBind();
}
public void Cancel(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ReportDataGrid.EditItemIndex = -1;
daList.Fill(DS,"Recognition");
daRecipient.Fill(DS,"Recipients");
ReportDataGrid.DataSource = DS;
ReportDataGrid.DataBind();
}
Any help will be appreciated.
Thanks!
MJ
I have a datagrid and I want to be able to edit a particular cell in
datagrid row.
I am using the EditCommandColumn control.My problem is when I hit
update the current row doesn't go in the edit mode.
Here is the snippet for asp:
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel"
UpdateText="Update" HeaderText="Edit Column" ButtonType="LinkButton"
HeaderStyle-Wrap="False"
ItemStyle-Wrap="False"></asp:EditCommandColumn>
Here are my edit,update and cancel methods:
public void EditGrid(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ReportDataGrid.EditItemIndex = (int)e.Item.ItemIndex;
//ReportDataGrid.
int foo = (int)e.Item.ItemIndex;
daList.Fill(DS,"Recognition");
daRecipient.Fill(DS,"Recipients");
ReportDataGrid.DataSource = DS;
ReportDataGrid.DataBind();
}
public void Update(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string NewData;
TableCell NotesCell = e.Item.Cells[6];
TextBox EditBox;
EditBox = (TextBox)NotesCell.Controls[0];
NewData = EditBox.Text;
//TODO: modify the data in DB acc to the entry
ReportDataGrid.EditItemIndex = -1;
daList.Fill(DS,"Recognition");
daRecipient.Fill(DS,"Recipients");
ReportDataGrid.DataSource = DS;
ReportDataGrid.DataBind();
}
public void Cancel(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
ReportDataGrid.EditItemIndex = -1;
daList.Fill(DS,"Recognition");
daRecipient.Fill(DS,"Recipients");
ReportDataGrid.DataSource = DS;
ReportDataGrid.DataBind();
}
Any help will be appreciated.
Thanks!
MJ