I have a grid that contains name,value and value is text box.
submit button is outside the grid.
on the click of submit button the grid values should save as xml data in database..,
need urgent solution...,
private DataTable CreateDatatable()
{
DataTable dt = new DataTable();
dt.Columns.Add("Boundary_Id");
dt.Columns.Add("Boundary_Name1");
dt.Columns.Add("Boundary_Name2");
dt.Columns.Add("Boundary_Value");
dt.Columns.Add("Status");
DataRow dr = dt.NewRow();
dr["Boundary_Id"].ToString();
dr["Boundary_Name1"].ToString();
dr["Boundary_Name2"].ToString();
dr["Boundary_Value"].ToString();
dr["Status"].ToString();
dt.Rows.Add(dr);
return dt;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
BoundaryMapping objBoundmap = new BoundaryMapping();
objBoundmap.Boundary_Name1 = ddlbcon.SelectedValue;
foreach (GridDataItem item in gvboundarymap.MasterTableView.Items)
{
if (item is GridDataItem)
{
TextBox txtbvalue = (TextBox)item.FindControl("txtbvalue");
objBoundmap.Boundary_Value = txtbvalue.Text;
}
}
DataSet ds = new DataSet();
using (StringWriter sw = new StringWriter())
{
dt.WriteXml(sw);
XML = sw.ToString();
}
string strStatus = string.Empty;
}
this wat i done how to proceed..?
}
Datatable to XML
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Oct 12, 2012, 2:18 AM EDT
http://www.c-sharpcorner.com/UploadFile/1a81c5/populating-values-from-xml-to-grid-view-and-from-grid-view-t/
It will help you