Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Datagrid Paging


Message #1 by "Shay E. Phillips" <sphillips@m...> on Tue, 14 May 2002 16:09:52
I am using a datagrid to display and edit an XML file. When I got paging 
working I found that the updates to my XML file were updating the wrong 
row. I'm not sure how to find the original row in the non-paged dataset.
Here is my update func:
void EditFAQ_Update(object sender, DataGridCommandEventArgs e)
{
	//Work on Paging issues...
	DataSet objDataSet = LoadMyFAQData();
	int row = Convert.ToInt32(e.Item.ItemIndex);
	TextBox EditText = null;
	EditText = (TextBox)e.Item.FindControl("EditFAQNumberTextBox");
	objDataSet.Tables[0].Rows[row]["Number"] = EditText.Text;
	EditText = (TextBox)e.Item.FindControl("EditFAQTitleTextBox");
	objDataSet.Tables[0].Rows[row]["Title"] = EditText.Text;
	EditText = (TextBox)e.Item.FindControl
("EditFAQDescriptionTextBox");
	objDataSet.Tables[0].Rows[row]["Description"] = EditText.Text;
	EditText = (TextBox)e.Item.FindControl("EditFAQSolutionTextBox");
	objDataSet.Tables[0].Rows[row]["Solution"] = EditText.Text;
	objDataSet.WriteXml(Server.MapPath("..//FAQ.xml"));
	Session["MyFAQData"] = null;
	EditFAQDataGrid.EditItemIndex = -1;
	EditFAQDataGrid.DataSource = LoadMyFAQData();
	EditFAQDataGrid.DataBind();
}

Any ides?

Thanks in advance!

Shay

  Return to Index