Click here to Skip to main content
15,889,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
help me to create xml schema file of gridview dataset dynamically
Posted
Comments
Vedat Ozan Oner 6-Mar-14 3:38am    
google answers this question in 0.35 secs: https://www.google.com.tr/#q=how+to+create+a+xml+schema+file+of+gridview+dataset

1 solution

I guess you are looking for XML to DataSet or GridView and back[^].
 
Share this answer
 
Comments
jj1992 6-Mar-14 4:20am    
thanks..... but i'm working in web application were grid column property doesnot exist
Where exactly is the problem? Can you please indicate that?
jj1992 6-Mar-14 5:28am    
foreach (DataGridViewColumn col in dataGridView1.Columns)
{
dt.Columns.Add(col.DataPropertyName, col.ValueType);
}
//adding new rows
foreach (DataGridViewRow row in dataGridView1.Rows)
{
DataRow row1 = dt.NewRow();
for (int i = 0; i < dataGridView1.ColumnCount; i++)
//if value exists add that value else add Null for that field
row1[i] = (row.Cells[i].Value == null ? DBNull.Value : row.Cells[i].Value);
dt.Rows.Add(row1);
}
Try the following code.

foreach (DataColumn col in GridView1.Columns)
{
dt.Columns.Add(col);
}

//adding new rows
foreach (DataRow row in GridView1.Rows)
{
DataRow row1 = dt.NewRow();

for (int i = 0; i < GridView1.Columns.Count; i++)
//if value exists add that value else add Null for that field
row1[i] = (row[i] == null ? DBNull.Value : row[i]);
dt.Rows.Add(row1);
}
jj1992 6-Mar-14 23:31pm    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900